Jump to content

[simply] getting product details... ?


ChicoMendez

Recommended Posts

Hi there

 

im new to PS (many years of joomla experience) an i need a little help please.

 

1> Im basically looking for the code to get one (random) product from a given category ($cid) which has the meta tag of 'featured';

 

2> if i have all the product info how do i get the path of the main image

 

many thanks for any help !

Chico

 

 

Link to comment
Share on other sites

1.  The best way to do that would be to write a custom SQL query, you can probably get most of the code by looking at an existing module, ie. HomeFeatured (this however does not use the metatag as a criteria)

 

2. In your smarty code, you can use this

{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}

the most important variables is the image id, which should be in the product information and the size of the image which can be set in Prestashops BO.

  • Like 1
Link to comment
Share on other sites

Hi there

 

many thanks for your help

 

i have tried to find the mysql statement you refer to in HomeFeatured but i cant find any !

all i can find is calls to getProducts function like here :

 

$category->getProducts(

 

anyone know where i can actually see the mysql statement required to pull all the product details (so as i can modify it to my liking)

 

tnx

chico

Link to comment
Share on other sites

Hi there

 

many thanks for your help

 

i have tried to find the mysql statement you refer to in HomeFeatured but i cant find any !

all i can find is calls to getProducts function like here :

 

$category->getProducts(

 

anyone know where i can actually see the mysql statement required to pull all the product details (so as i can modify it to my liking)

 

tnx

chico

 

I don't have access to my Prestashop files at the moment, but you can see all the prestashop queries in the files in the class folder.  Most probably the query you are looking for is in the category.php or product.php file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...