Remove Add to Cart button on product listing

  • Posts: 13
  • Thank you received: 1
12 years 3 months ago #57985

I expect that I am missing something obvious, but I'd be grateful for help. I've set the "Display Add to Cart button" to no in the default parameters for products, but the button still shows.
I've search and searched but can't find what I've missed. Anyone help?
Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82725
  • Thank you received: 13338
  • MODERATOR
12 years 3 months ago #58026

Hi,

That's a default parameter. So it works only for new menus and modules.
For existing menus and modules, you will find similar options via the menus Display->Content menus/modules.
You can also just create a new menu and it will use that value.

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 1
12 years 3 months ago #58794

Thanks for this help. I'm please I asked before we got much further, having created dozens of product listings already!

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
12 years 3 months ago #59270

Hello Nicolas.

I am using just the starter version. I am also looking for a solution to this without having to delete existing modules or hacking the PHP code.

The method you mention: "For existing menus and modules, you will find similar options via the menus Display->Content menus/modules."

This does not seem to be correct, I do not see the option to Display/not display the "Add to cart" button in the Display > Content menus.

Can you confirm?

Please Log in or Create an account to join the conversation.

  • Posts: 82725
  • Thank you received: 13338
  • MODERATOR
12 years 3 months ago #59300

I can confirm that this method is correct.
Once you are in the menu Display > Content menus, you need to edit your products listing menu and you will see the option among all the other options of your products listing menu.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
12 years 3 months ago #59355

nicolas wrote: I can confirm that this method is correct.
Once you are in the menu Display > Content menus, you need to edit your products listing menu and you will see the option among all the other options of your products listing menu.


As always Nicolas you are correct, thank you.

This may not be the place to raise this suggestion:
I find all the answers to any question I have on this forum - which is very nice, but I would prefer a lot of these things to be documented properly.

And, I find the main documentation for Hika Shop a bit lacking - sometimes parts are missing altogether and sometimes the language is very confusing.

Since a lot of people are using this extension in its free version, would you consider opening up your documentation (as a Wiki for example) so that the community that are using can at least contribute something, prepare FAQ for things such as the one here and keep the main documentation updated?

Regards,

Please Log in or Create an account to join the conversation.

  • Posts: 82725
  • Thank you received: 13338
  • MODERATOR
12 years 3 months ago #59416

You are more than welcome to write tutorials and such for HikaShop.
We would be even more happy to include them in our documentation if you are ok with that.
If you do so, just send a contact request to us via our contact form:
www.hikashop.com/en/contact-us.html

Also, if you have specific things you would like to add in one place or another in the FAQ, do not hesitate to tell us. We will be more than happy to improve the documentation.

A wiki wouldn't allow us to include the documentation inside HikaShop views like we do at the moment, so I don't see that happening in the short term though.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 1
11 years 1 month ago #123647

Hi, I need some help please.
I 've found the content menu, but I am trying to remove the add to cart buttons only in one subcategory.
How can I override the existing options of my main category?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #123743

Hi,

You have to override the view "product / listing" and in the foreach on the categories "foreach($this->categories as $category) {" add a code like:

$oldAddToCartParameter = $this->params->get('add_to_cart');
if($category['category']->category_id == your_category_id){
    $this->params->set('add_to_cart', 0);
}else{
    $this->params->set('add_to_cart',$oldAddToCartParameter);
}

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 1
11 years 1 month ago #123777

Thank you for the reply, but this code I think will be change all my products, and I want to remove the button only in one category!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #123841

Yes, that's why there is a check on the category id, you have to replace "your_category_id" by the category where you want to hide the add to cart button.

So all the products of this category will not have the "add to cart" button displayed.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 1
11 years 1 month ago #123845

This is my product / listing file, but I don't find where to put the code, can you help me?:

Full source code of the view removed. Don't worry, we have it too :)

Last edit: 11 years 1 month ago by Jerome.

Please Log in or Create an account to join the conversation.

  • Posts: 26150
  • Thank you received: 4026
  • MODERATOR
11 years 1 month ago #123871

Hi,

Replace:

	foreach($this->categories as $category) {
		if(empty($category['products']))
			continue;
By
$oldAddToCartParameter = $this->params->get('add_to_cart');
	foreach($this->categories as $category) {
		if(empty($category['products']))
			continue;
if($category['category']->category_id == 0 /* Put your category id instead of 0 */ ){
    $this->params->set('add_to_cart', 0);
}else{
    $this->params->set('add_to_cart',$oldAddToCartParameter);
}
Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 1
11 years 1 month ago #124044

I'm sorry but the part:

foreach($this->categories as $category) {
		if(empty($category['products']))
			continue;

Does not exist in my view file. Is it another version? My hikashop business version is 2.2.1.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #124086

Hi,

It's near the line 221. If you don't have it, that's maybe because you have an override on this view.
Thanks to save your current override in an external file, then remove the override by clicking on the dustbin on the views listing.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 1
11 years 1 month ago #124224

As you can see in the picture there is no override and the line of the code not exist!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #124262

Thanks to try to download the latest version of HikaShop from our website and install it over your current version, you should have the code after this update.

Please Log in or Create an account to join the conversation.

  • Posts: 149
  • Thank you received: 0
10 years 11 months ago #133000

hi ,

how i can remove the add to cart from the product listing here

server.webartscy.com/~mazrin/index.php/h...egory/13-decorations

i set the the value to No at the product listing option but nothing change

also i want to hide the product code from the product listing .

Last edit: 10 years 11 months ago by webarts.

Please Log in or Create an account to join the conversation.

  • Posts: 82725
  • Thank you received: 13338
  • MODERATOR
10 years 11 months ago #133069

Hi,

I don't see the add to cart button on that listing.
Regarding the product code, you would need to add such CSS:
.hikashop_product_code_list{ display: none; }

How to add CSS:
www.hikashop.com/support/documentation/1...ize-the-display.html

Please Log in or Create an account to join the conversation.

  • Posts: 149
  • Thank you received: 0
10 years 11 months ago #133279

sorry Nicolas i was facing problems with the template,

here is the url

server.webartscy.com/~mazrin/index.php/h...ategory/14-ornaments

i set on the content menu product listing the option "Display 'Add to cart' button" to NO .

Please Log in or Create an account to join the conversation.

Time to create page: 0.124 seconds
Powered by Kunena Forum