Display message in checkout if a product from categoy X or Y is in the basket - conditional-statements

I'm going to edit the shipping.tpl file of my Prestashop theme and what I need to do is to show a text if product from categoy X or Y is already in the basket.
Any ideas on how to get this conditional statement working in Prestashop?

Use CartController or classes Cart to check if your product from a category is already in the cart.
CartController will use for display cart page so you can use the message controller error or warning, as you want
$this->warning[] = 'message';
$this->error[] = 'message error';
Cart classes will be used to check if the user try to add a product from category

Related

In Opencart 3 under PHP 8 how do I call module to show in another page

I have seen on this site the post re calling a module on needed page. I have tried to use this code to solve a problem. This code does not appear to work for me.
What I have is a module that places a label over each product depending on its status. It works well on products throughout site. However I have a module which calls all products on to one page. I want the label to appear on the products on this all products page.
Banner on product
The code I used in catalog/controller for the all product extension from previous post here was (382 is the label module number):
$this->load->model('382');
$my_variable = $this->model_setting_module->getModule('382');
$data['any_variable'] = $my_variable['any_variable'];
On Template page:
{{ any_variable }}
How can I get the module to be apply the label to the custom all products page?
As always help appreciated
Create new module with name: "my_module" and you can call it in your "another_module" controller file:
$data['my_module'] = $this->load->controller('extension/module/my_module');
and in corresponding "another_module" template file you can retrieve it:
{{ my_module }}

Why description has <p><br></p> in description by default for some products in stock form odoo 15?

In Inventory, some products description shows the tag as given in image
by default. Why it shows and how it raised under which condition?
try this changes in your code
<p><br></p> replace with <p><br/></p>

Creating module on prestashop

i need to create a module on prestashop on product page , im new in prestashop idk how to do that .
This module should be on bottom of page ,it contains product technical description
Can someone tell me how to do that
Ps : i know nothing about prestashop Hooks ....
Thanks in advance!
There is one hook that may fit you.
displayProductFooter
First you have to add the hook registration in your module install function
public function install()
{
...
$this->registerHook('displayProductFooter');
}
Then create a function to display the content in the hook
Save the content you want to display and use the return to send a string with all the HTML you want to print in the product footer.
In the params you will also find some useful variables like the product ID.
public function hookDisplayProductFooter($params)
{
// Your content here
return $output;
}
The same procedure should work with any other hook (as long as it's a display hook)

virtocommerce An error occured while updating cart

I have create a new store and add new physical item under category. when i click on item add to cart it shows me error?
How i can add item to cart..?
Thanks for updating your question. Seems that your product has no any images, so just add some primary image for your product and try to add it to shopping cart again. The presence of product primary image is necessary condition for now - as you can see an exception was occurred while converting your product to shopping cart line item at 22 line - product property PrimaryImage is null.

How to display limited brands in bigcommerce

I am setting up a store in bigcommerce. In my theme there is a list of brands on the bottom of the page. It is displaying 10 brand names and i want to display only 4 or 5 brand names. can anyone help me how i can limit brands?
Hardeep, you'll need to use a javascript that removes the extra list items. Possibly just use jQuery slice
$(".Brands ul li").slice(5).remove();
http://api.jquery.com/slice/