Global Add to cart on wishlist

  • Posts: 214
  • Thank you received: 10
  • Hikashop Multisite
1 month 2 weeks ago #365658

-- HikaShop version -- : 5.1.3

Hi,

I have enabled the Add to cart on listings "global" setting.
But i only want to show it this way on the wishlist, all other listings need to have a one per product button.
Can you tell me which file i need to edit, because i don't see a setting for this?

Kind regards,
Jeroen

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

  • Posts: 83488
  • Thank you received: 13510
  • MODERATOR
1 month 2 weeks ago #365669

Hi,

I'm not following you. The wishlist page displays the same regardless of how the "Add to cart on listings" setting is configured.
This setting is only for add to cart buttons, on products listings and on the product details page.
So just configuring that setting to "per product" should do what you want.
But maybe I'm missing something ?

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

  • Posts: 214
  • Thank you received: 10
  • Hikashop Multisite
1 month 2 weeks ago #365670

Hi,

Sorry i was not clear.

I would like to display the wishlist with 1 order button at the bottom of the wishlist. Like a global "Add to cart on listings" page.
But all other pages need to have a per product like "normal".

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

  • Posts: 83488
  • Thank you received: 13510
  • MODERATOR
1 month 2 weeks ago #365671

Hi,

Isn't there already a global add to cart button in the top button bar of the wishlist page ?
For example:
i.imgur.com/wU8xQn5.png
There, you can see the wishlist page. And you have an "add to cart" button at the top, between the "share" and "move to" buttons.
And on the left side of the wishlist table, you have a checkbox for each product. When you click on the add to cart button, it will add to the cart all the products whose checkbox is checked.
Are you saying that your problem is that you want this button to be at the bottom instead of the top ? Or are we talking about a different place ?

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

  • Posts: 214
  • Thank you received: 10
  • Hikashop Multisite
1 month 1 week ago #365732

Hi,

Thanks for your answer, I see what you do, but this is not what i'm looking for.

The wishlist is used as a personal product-list. Each customer has his own list of products and orders multiple times a week.
The customer don't order each time the same product and also not the same number of products.

We are looking for a way to display the list where a visitor can change the number of products easily in the way like the global add-to-cart option works. The way you show (with checkbox) is not easy, especially not on a mobile phone, because the customer don't want to select the complete list.
Is there a way to change this view?

Kind regards

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

  • Posts: 83488
  • Thank you received: 13510
  • MODERATOR
1 month 1 week ago #365733

Hi,

You can change this view by editing the file cart / show via the menu Display>Views.

The thing is that the quantity input there are the quantity of the products in the wishlist. If you set it to 0, then the product will be removed from the wishlist.
So using the quantity input for the add to cart, without impacting the wishlist is not supported.
That's why we had to have checkboxes there so that the products of the wishlist can be selected to be added to the cart.

An alternative might be to use the "like" plugin:
www.hikashop.com/marketplace/product/155-product-like-btn.html
With it, users can like the products they want.
And you can create a products listing menu item with only the liked products.
And since this is a normal products listing, it works similarly to other products listings with the global add to cart system.

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

  • Posts: 214
  • Thank you received: 10
  • Hikashop Multisite
1 month 1 week ago #365742

The like button might be the most straight-forward solution.

Is there a way to only display the menu-item with the liked-products in the global add to cart view and the other pages in a normal table?

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

  • Posts: 83488
  • Thank you received: 13510
  • MODERATOR
1 month 1 week ago #365744

Hi,

While there is no option you can change for this, it's possible to activate it locally with a small view override.

You want to edit the view file product / add_to_cart_ajax via the menu Display>Views. There, after the line:

$global_on_listing = $this->config->get('show_quantity_field') == 2;
you could add something like this:
global $Itemid;
if($Itemid==XX)
$global_on_listing = true;
where XX would be the id of the menu item for the liked products listing.
That way, the global add to cart will be used on that menu item, and other products listings will display normally, with one add to cart button per product.

Last edit: 2 weeks 1 day ago by nicolas.

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

  • Posts: 214
  • Thank you received: 10
  • Hikashop Multisite
2 weeks 1 day ago #366161

Thank you,

When i add this code the add to cart button is hidden.
But there should be an global add to cart button at the bottom. (see attachment)

I can't find this button or code in the template-files.

When i use the global_on_listing option in the configuration, it works fine, but on all pages.
All other overrides are disabled for now.

Can you tell me how to show this?

Attachments:

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

  • Posts: 83488
  • Thank you received: 13510
  • MODERATOR
2 weeks 1 day ago #366164

Hi,

Ah, right. I had forgotten about half of the pieces. I'll suppose that you're using a display in "div" mode for your products lisitng menu items, and not "table" or "list".
If you look in the product / listing_div view file, and search for "show_quantity_field" you can find two pieces of code:

	if($this->config->get('show_quantity_field') >= 2 && empty($this->tmpl_ajax)) {
?>
	<form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $mainDivName; ?>" enctype="multipart/form-data">
<?php
	}
before the products listing's HTML, and :
	if($this->config->get('show_quantity_field') >= 2) {
		$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_'.$mainDivName.'\')){ return hikashopModifyQuantity(\'\',field,1,\'hikashop_product_form_'.$mainDivName.'\'); } return false;';
		$this->row = new stdClass();
		$this->row->prices = array($this->row);
		$this->row->product_quantity = -1;
		$this->row->product_min_per_order = 0;
		$this->row->product_max_per_order = -1;
		$this->row->product_sale_start = 0;
		$this->row->product_sale_end = 0;
		$this->row->formName = 'hikashop_product_form_'.$this->params->get('main_div_name', '');
		$this->row->prices = array('filler');
		$this->params->set('show_quantity_field', 2);

		$this->setLayout('quantity');
		echo $this->loadTemplate();
		if(!empty($this->ajax) && $this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
?>
		<input type="hidden" name="popup" value="1"/>
<?php
		}
?>
		<input type="hidden" name="hikashop_cart_type_0" id="hikashop_cart_type_0" value="cart"/>
		<input type="hidden" name="add" value="1"/>
		<input type="hidden" name="ctrl" value="product"/>
		<input type="hidden" name="task" value="updatecart"/>
		<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url))); ?>"/>
	</form>
<?php
	}
after the products listing.
These pieces will add a form element around the whole products listing, along with hidden input fields and the add to cart button at the bottom.
So, on top of the previous modification, you would also have to change the checks
$this->config->get('show_quantity_field') >= 2
in this view file to check on $Itemid.
For example, instead of
if($this->config->get('show_quantity_field') >= 2) {
you could have:
global $Itemid;
if($Itemid == XX || $this->config->get('show_quantity_field') >= 2) {

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

Time to create page: 0.072 seconds
Powered by Kunena Forum