Jump to content

Link carriers to each product on product-list


_oc_2110

Recommended Posts

Greetings,

Today I'm adding visual stickers to my products in order to show the user which carriers will be available, so they won't have a cart with 10 products delivered and 1 to pickup in store.
They'll immediately know what they can do.

No problem on single product page, adding this in ProductController.php is enough :

$this->context->smarty->assign(array(
                'pictures' => $pictures,
                'textFields' => $text_fields,
                'carriers' => $this->product->getCarriers(),
				));

The point comes to product-list page ... I can't seem to find out what I can do to link the carriers to each product of the category (currently looking in CategoryController).

Does anybody have already done something like this ? 

Link to comment
Share on other sites

I could go a little further, in ProductListingFrontController,

protected function doProductSearch($template, $params = array(), $locale = null)
    {
        if ($this->ajax) {
            ob_end_clean();
            header('Content-Type: application/json');
            $this->ajaxRender(json_encode($this->getAjaxProductSearchVariables()));

            return;
        } else {
            $variables = $this->getProductSearchVariables();

...

All listing products are inside $variables, but looking in the documentation of Prestashop, I can't seem to find how to access products and loop through them.

Still nobody has a lead to this issue ?

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...