Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to create a Product Grid listing same as Prestashop Theme | in Prestashop V-1.7 Module

    Lets first understand the problem, if you want a grid view of products on your Prestashop controller in a module like this in the screen shot

    how to get this view in Prestashop, will you start this by writing a template and css for the same, I don’t think will be a good idea.

    I am telling you a nice and simple way to get this view,

    and the amazing fact is that what if there are a new theme installed in the prestashop, yes the solution will be compatible to any theme. see this in Prestashop Responsive Inventive Theme

    so lets straight come to the coding part, here the first step is to use some needed packages at the top of your module class,

    now create a front controller or hook and return a smarty file from this.

    and write the following code on this smarty template file,

    as you can see this here I have directly include a smarty template file which is including from theme.

    so obviously will be compatible with the current theme 🙂

    I include the templete file in a foreach loop of products ($disountProducts)

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .

    now the question is what is in this variable $disountProducts.

    of course the product details, but what is the format and how to create this.

    so lets create this array.

    here in $discountedProducts key id_products is required, other needed data will be assemble later.

    so now the next step is to create the needed class objects,

    now come to the last step to get the required array.

    here I use $assembler->assembleProduct($productDetail) to assemble the needed product details.

    thats it.

    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again