• 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

Retrieve and display data from mtb_products table

+3 votes
Will you please tell me how to i retrieve data from mtb_products to products/list.php?category_id=1 page?

For ex:

    I added new column named charamt in mtb_products. I want to retrive the value from mtb_products to display in products/list.php?category_id=1 by already view condition.

where to mention column in LC_Page_Products_List.php?

Thanks in advance.
asked 2013-05-14 by shahith (850 points) SAMURAISAMURAI
retagged 2013-05-14 by shahith

1 Answer

+2 votes

If you take a look at the SC_Product class:

/data/class/SC_Product.php

You will need to append your column name to the list of columns in the following methods:

lists()    //line 130  (used for the list page)
alldtlSQL()  //line 600 (used for the individual product page)


Once done, it should then be accessible in the template:

/data/smarty/templates/default/products/list.tpl



Of course,  the best method to make these alterations would be to extend the methods in the SC_Product_Ex class rather than editing the SC_Product class directly.


 

answered 2013-05-14 by Jeemusu (690 points) KABUKIKABUKI
edited 2013-05-14 by Jeemusu
James morris
  Thank you for your answer. Im really sorry to say this I did above mention code before. But it will not display data for all field in the dtb_products table and also for my newly added field(charamt). will you please tell me i have to define in some other page.? Thanks in advance.
Sorry shahith. Previous answer was wrong, I have updated it with the correct information. I just tested it on my site and it worked fine. Let me know if there are any problems.
Thank you very much for your guidance. I found solution by just adding my field name in function (function lists(&$objQuery)) in SC_Product.php page.
Good to know. The list() method is for the product list page, while alldtlSQL() is for the individual product page, should you also need to have access to it there.
James morris
Thank you i added in alldtlSQL and i forget to mentioned in previous post.
Im sure your information is very useful for EC Cube learner.
...