How to show add to cart global and per product

  • Posts: 367
  • Thank you received: 7
  • Hikashop Business
8 years 7 months ago #254170

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6

Hi,

We are developing a site where we need 2 different type of layouts.

First layout: www.identityweb.co.uk/index.php?option=c...t=listing&Itemid=598

Please click on either of those two categories and you can see the list of product with the one add to cart button - this is good and how we want it to work.

Display the quantity field on the product page = "Global on Listing"

However, if we look at this category:

www.identityweb.co.uk/index.php?option=c...t=listing&Itemid=554

How can that category revert back to the normal add to cart per product. Is there a solution?

Many thanks.

Last edit: 8 years 7 months ago by grayt7.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #254196

Hi,

You need to edit the file "listing" of the view "product" for your frontend template via the menu Display>Views and add such code at the top:

if(in_array($this->element->category_id, array(XXX, YYY))){
$this->config->set('show_quantity_field',1);
}
And that will revert to normal add to cart buttons for the categories XXX and YYY.

The following user(s) said Thank You: grayt7

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

  • Posts: 367
  • Thank you received: 7
  • Hikashop Business
8 years 7 months ago #254239

Can you also set the product template layout from table to div this way?

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #254240

Sure. It's the same principle.
But with the line:
$this->params->set('layout_type', 'div');
instead of :
$this->config->set('show_quantity_field',1);

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

  • Posts: 367
  • Thank you received: 7
  • Hikashop Business
8 years 7 months ago #255571

HI, thanks for the info.

Running on similar lines what if I wanted to include products on this page:

www.identityweb.co.uk/index.php?option=c...t=listing&Itemid=598 but in the Div view not table layout which is what you get one you click on any of those categories?

There are a lot of categories so I'm reluctant to be creating menu items for each category, is there an easier way please?

Many thanks.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
8 years 7 months ago #255581

Hi,

I don't understand what you mean ? The code I gave previously already allow you to do that without having to create menu items for each category.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum