Live quantity check in cart

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 6 days ago #362103

-- HikaShop version -- : 5.1
-- Joomla version -- : 4.4.6
-- PHP version -- : 8.2

Hey there,

I need an instant stock update of available products when a user adds products to cart. (stock is 100, user 01 put 4 tickets in the cart, stock goes to 96, user 02 puts 2 tickets in the cart. stock goes to 94 etc.)
At the moment, the stock only changes after place a order. I´m creating a website for a small concert hall at the moment. If the ticket sale starts, a lot of people will try to get the limited tickets.
They get angry if they don't get the tickets even though the tickets were already in the shopping cart.

I found the "Cart Reservation" plugin. Does the plugin achieves this? www.hikashop.com/marketplace/product/208...art-reservation.html

Thank you.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 6 days ago #362106

Hi,

Yes, the plugin is made specifically for this kind of need.

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 5 days ago #362124

Okay, I have bought it and installed it. But.. I have tried it and the quantity doesn´t count down after putting articles in the cart.
For example, I put the last 2 products in the cart, refreshing the site and there are still 2 articles available.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 5 days ago #362125

Hi,

The stock display on the product page doesn't change. It is the stock directly from the database. The stock displayed on the product page only changes once the order is made / paid.
However, if you try to add the product to the cart and all the stock is reserved in others' cart, the add to cart will be refused and an error message will be displayed instead.
So the best way to test is to have a product with a low stock, like 2 or 3, and open your website on different browsers so that you can add the product to the cart in the different browsers.

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 5 days ago #362129

well, so it is not like i´m asking for... I need something that displays the live stock without the number of articles in carts. It´s cool that it reserve the carts, but I have used another shop system before hikashop for this client and he would like it to be like that again.

People get mad when they see there are 20 items left but no more are being added to the cart. They don't look at the information in pop-ups, but instead call angry and ask why it's no longer possible.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 5 days ago #362132

Hi,

That should not happen. On top of displaying an error message to the user trying to add a product to his cart with all its stock left reserved, the plugin will display a message saying that all the stock is reserved instead of displaying the stock on the product page.
So it's only if not all the stock is reserved and you look at the product page that you'll see the stock.

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 4 days ago #362139

mh maybe I did something wrong, but you can test it here: test.palue-mannheim.de/
There is still something in the stock after adding the 2 remaining tickets of the event to cart.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 4 days ago #362150

Hi,

I was specifically talking about the product page.
I can see on your link that the product is displayed with a content tag.
There is a piece of code missing in the cart reservation plugin to support content tags.
So I'm thinking of adding it.
However, even if I do, it should display properly on the product page here:
test.palue-mannheim.de/index.php?option=...duct&task=show&cid=1
And I don't see the change there on your website.
Maybe there is a view override from your template which prevents the change from happening ? Could you try on the product page with the default frontend template of Joomla ? If it works, then it means there is a view override in the folder templates/YOUR_TEMPLATE/html/com_hikashop/product/ which is missing something.
If it doesn't, then there is something else we need to investigate. For this, we would need a backend and FTP access which you could provide via our contact form: www.hikashop.com/support/contact-us.html

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 4 days ago #362152

Hi there,

thanks for your help and sorry I have forgotten to say you that I´m using the content tag.

I have tried it with a default theme (cassiopia) and wrote the content tag in a normal article: test.palue-mannheim.de/kontakt-anfahrt
the same problem.

I tried the product page (test.palue-mannheim.de/index.php?option=...duct&task=show&cid=1) with my template and after refreshing the site or open it in another server i got the reservation hint.

I think, the problem is the content tag and it would be nice you can add the piece of code :-)

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 4 days ago #362155

Hi,

Add the code:

					$row->product_stock_message = JText::sprintf('X_ITEMS_RESERVED', $main->product_quantity);
					$row->product_quantity = 0;
before the code:
$html = '<div class="cart_reservation_listing_label">'.JText::_('PLG_CART_RESERVATION_RESERVED').'</div>';
and change the line:
if($viewName == 'product' && $layout == 'listing') {
to:
if($viewName == 'product' && in_array($layout, array('add_to_cart_listing', 'listing'))) {
in the file plugins/hikashop/cart_reservation/cart_reservation.php via FTP and it should do it. Please confirm that it works for you so that we can publish a new release of the plugin with the modification.

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 4 days ago #362156

unfortunately not :-(
added the code:

if($viewName == 'product' && in_array($layout, array('add_to_cart_listing', 'listing'))) {
			foreach($view->rows as $k => $r) {
				$row =& $view->rows[$k];
				if(!isset($row->extraData))
					$row->extraData = new stdClass();
				if(!isset($row->extraData->afterProductName))
					$row->extraData->afterProductName = array();
				if(!$this->isValid($row, $quantity_to_add)) {
					$row->product_stock_message = JText::sprintf('X_ITEMS_RESERVED', $main->product_quantity);
					$row->product_quantity = 0;
					$html = '<div class="cart_reservation_listing_label">'.JText::_('PLG_CART_RESERVATION_RESERVED').'</div>';
					$row->extraData->afterProductName['cart_reservation'] = $html;
				}
			}
		}

Last edit: 4 months 4 days ago by nicolas.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 3 days ago #362159

Hi,

Could you provide a backend and FTP access via our contact form: www.hikashop.com/support/contact-us.html

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 3 days ago #362170

done. Thanks for your help

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 2 days ago #362186

Hi,

Thanks for the accesses. The solution to support the content tags was actually a bit more complex that I thought it would be.
I've made the necessary changes and confirmed that it now works on your website. We'll be publishing a new version of the plugin with that capability soon.

Regarding the limit you asked about in your email, I didn't find any problem with it. I changed the stock of the product to 50 and the quantity per order to max 20, and the limit is kicking in if I try to add more than 6 items of that product to my cart on your website. So it seems to be working just fine. Could you elaborate on why you think it doesn't work ?

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
4 months 2 days ago #362190

ok, it works, but... every product which is sold out has now "0 items reserved" as message instead of "sold out". :-/

I thought with the limit feature you could control that the customer can only buy a total of 6 tickets at a time. This means that he will not be able to buy any more in the future if he has already purchased 6.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
4 months 2 days ago #362194

Hi,

Thanks for your feedback. That's indeed a good point. The stock message shouldn't be changed by the plugin when the stock of the product is 0. I've made another modification to the plugin for this.

And yes, with the limit feature you can enforce the fact that a user won't be able to buy a product if he already purchased it 6 times. Now, checking your limit rules and doing a bit of debug with the FTP access, I found out that if you keep the "order status" to "all" in your limit, it doesn't take into account the past orders due to a change we made for Joomla 5 support for the order status selector.
It wasn't found for a while as usually people set order statuses in limits so that refunded, cancelled or created orders are not taken into account for the counting.
I've made a patch to support this and confirmed that it now works with "all" selected in the order status selector of limits.

I've also included the patch on our end. So, for anyone with the same issue, download the latest version of the HikaShop install package on our website and install it on yours and you'll get the patch.

The following user(s) said Thank You: TobiasR

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

  • Posts: 9
  • Thank you received: 0
  • Hikashop Business
3 months 3 weeks ago #362396

sorry, i was away for a same days. Thanks for your help.
Can you tell me where I can change the text for the cart reservation tool? Can´t find the namekeys in the language tab.

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

  • Posts: 82823
  • Thank you received: 13370
  • MODERATOR
3 months 3 weeks ago #362398

Hi,

The language tab in HikaShop is only for the translation keys in HikaShop itself. We made it 15 years ago because at the time, Joomla didn't had any interface to create overrides, even though the capability was there.
Each plugin has its own language file(s), like any Joomla extension.
And now, Joomla has a translation override editor you can use to edit the text of any extension, including HikaShop's:
docs.joomla.org/J3.x:Language_Overrides_in_Joomla

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

Time to create page: 0.089 seconds
Powered by Kunena Forum