Search code examples
phpprestashopprestashop-1.7

I want to view a specific category on my modal.tpl file PRESTASHOP


So I want after adding a product to the cart I want the user to be able to choose additions from the modal.tpl file which was the add to the cart confirmation, I only know that I need to edit the PHP controller for modal.tpl and add the following:

protected function getAccessoriesProducts()
{
    $accessories_cat_id = 239;
    $acc_category = new Category($accessories_cat_id);
    $acc_products = $acc_category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);

    return $acc_products;
}

Can anyone tell me what controller to change?


Solution

  • i finally figued it out, so the file I needed to modifer was /modules/ps_shoppingcart/controllers/front/ajax.php and what I did was adding this line of code and access the $add_products array from the modal.tpl template

    $id_category = 10
    $add_products = $add_products = Product::getProducts(Context::getContext()->language->id, 0, 0, 'date_upd', 'ASC', $id_category, true);