• Register
Plug-in Tutorial Build an EC-CUBE plug-in

Top Commentators

114

1

EC Mike

SHOGUNSHOGUN

32

2

hrbabu

SAMURAISAMURAI

29

3

Sumant Jha

SAMURAISAMURAI

29

4

justcubed

SAMURAISAMURAI

21

5

Ashok Kafle

SAMURAISAMURAI

21

6

shahith

SAMURAISAMURAI

14

7

Jeemusu

KABUKIKABUKI

14

8

Yangsin

KABUKIKABUKI

9

9

Zaw Hlaing Bwar

GEISYAGEISYA

8

10

Fei Liu

GEISYAGEISYA

Ranking Key

  • FUJISANFUJISAN1,000+ posts
  • SAKURASAKURA500+ posts
  • SHOGUNSHOGUN100+ posts
  • NINJYANINJYA50+ posts
  • SAMURAISAMURAI20+ posts
  • KABUKIKABUKI10+ posts
  • GEISYAGEISYALess than 10 posts

Retreive data from newly created table

+2 votes

Will you please tell me how to i retrieve data from newly created table to products/list.php

For ex:

    I added new table named dtb_charimg and dtb_charkeyboard. I want to retrive the data from both table and to display data in products/list.php.

Thanks in advance.

asked 2013-05-16 by shahith (850 points) SAMURAISAMURAI

1 Answer

+3 votes
 
Best answer

Hello Shahith,

 

I assume you want to display this new data outside of the listed products on the list.php page.

Put this in your action function (possibly you will want to place it after the switch statement:)

$this->arrData = $this->yoursqlfunction();

Now call your sql function.

function yoursqlfunction(){
$objQuery = & SC_Query_Ex::getSingletonInstance();
$sql = "SELECT * FROM DTB_CHARMING A, DTB_CHARKEYBOARD B WHERE A.key = B.key";
        $data = $objQuery->getAll($sql);
        return $data;
}

 Smarty template (tpl) loop:

<!--{foreach from=$arrData key=key item=item}-->
<!--{$arrData[$key].column_name|h}-->
<!--{/foreach}-->

Let me know if you need any more information!

Thank you,

Michael

  
answered 2013-05-16 by EC Mike (6,360 points) SHOGUNSHOGUN
selected 2013-05-17 by shahith
Michael,
Thank you for your answer.

I placed your code after switch statement.  code work fine.
Im sorry to say this, but problem is when i wrote in smarty template (list.tpl)
It lead to error. will you please tell me i have to define column_name in somewhere?
I updated my answer. The column name in the loop should be the column name in your table.
Michael
 Thank You for your answer. My module is working fine by your guidance. Thanks a lot.
...