Stock not updating on Confirmed

  • Posts: 37
  • Thank you received: 0
11 years 6 months ago #102338

Hi,
I have set my stock to update when on "confirmed" status (Configuration> system> product>update product on confirmed status).

When a customer selects to pay via Bank Transfer, the status automatically sets to "pending" (rather than "created") until we confirm the money has cleared into the account. Whereby we manually adjust the order status to "Confirmed". However, the stock is not updating once the status is changed to confirmed.

Can you please advise?
Thank you in advance.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #102378

Hi,

Which version of HikaShop are you using ?

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: 37
  • Thank you received: 0
11 years 6 months ago #102397

Business edition 2.1.2, the latest version.

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #102415

Hi,

Can you give us more details on your configuration ?

I triend on my end, and it's working fine.

What is the status of the order set in the payment method "bank transfer" ?
Have you created new order statuses ? (in addition to the standard one) ?

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

  • Posts: 37
  • Thank you received: 0
11 years 6 months ago #102419

Hi

I know it's got to be something really simple (and probably dumb too! :S )

Bank transfer order status is set to "Pending".
All the existing order statuses are:

Created
Confirmed
Cancelled
Refunded
Partial Refund (this one doesn't affect the stock)
Shipped
Pending

I can send screen captures of any configuration page you would like. Just let me know.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #102431

Hi,

Pending is not a default status, so you have to change the code in the file "administrator/components/com_hikashop/classes/order.php" function "save()", replace:

			if($config->get('update_stock_after_confirm') && isset($order->order_status) && isset($order->old->order_status) && $order_type == 'sale'){
				if($order->old->order_status == 'created' && in_array($order->order_status,array('confirmed','shipped'))){
					// Decremente product qty
					$this->loadProducts($order);
					if(!empty($order->products)){
						$productClass = hikashop_get('class.order_product');
						foreach($order->products as $product) {
							$product->change = 'minus';
							$productClass->update($product);
							unset($product->change);
						}
					}
				}elseif(in_array($order->old->order_status, array('shipped','confirmed')) && $order->order_status == 'created'){
					// Incremente product qty
					$this->loadProducts($order);
					if(!empty($order->products)){
						$productClass = hikashop_get('class.order_product');
						foreach($order->products as $product) {
							$product->change = 'plus';
							$productClass->update($product);
							unset($product->change);
						}
					}
				}
			}
By:
			if($config->get('update_stock_after_confirm') && isset($order->order_status) && isset($order->old->order_status) && $order_type == 'sale'){
				if( in_array($order->old->order_status,array('created','pending')) && in_array($order->order_status,array('confirmed','shipped'))){
					// Decremente product qty
					$this->loadProducts($order);
					if(!empty($order->products)){
						$productClass = hikashop_get('class.order_product');
						foreach($order->products as $product) {
							$product->change = 'minus';
							$productClass->update($product);
							unset($product->change);
						}
					}
				}elseif(in_array($order->old->order_status, array('shipped','confirmed')) && in_array($order->old->order_status,array('created','pending'))){
					// Incremente product qty
					$this->loadProducts($order);
					if(!empty($order->products)){
						$productClass = hikashop_get('class.order_product');
						foreach($order->products as $product) {
							$product->change = 'plus';
							$productClass->update($product);
							unset($product->change);
						}
					}
				}
			}

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

  • Posts: 37
  • Thank you received: 0
11 years 6 months ago #102445

Thanks, I will give it a go.

So just to clarify, this change will enable:

Customer clicks on to pay with bank transfer (order comes through marked as pending but stock doesn't change)>
After the bank transfer clears we manually change the status to Confirmed (and then the stock level changes)

and with Paypal payments:

Customer clicks and pays with Paypal (order comes through as confirmed and the stock level changes)

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #102452

Yes this change will enable that.

For Paypal it's already the case, the change just add the 'pending' status as the 'created' to change the quantity when stock change from 'pending' to 'confirmed' and 'confirmed' to 'pending'.

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

  • Posts: 37
  • Thank you received: 0
11 years 6 months ago #102495

Unfortunately it didn't work. Still no stock update going from Pending to confirmed.

I have changed it back and changed the bank transfer order status to go from created to confirmed (It works in this configuration)
Unless there is something else, I will just scrap the idea of "pending"

Thanks for your help.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #102497

There is a lot of things to edit in order to change the status for custom order statuses in the class "order".
It's on our TODO list.

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

  • Posts: 37
  • Thank you received: 0
11 years 6 months ago #102583

That would be great to have the option of going from pending to confirmed in later editions. I look forward to it!

Thanks for your help.

Marisa

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

Time to create page: 0.085 seconds
Powered by Kunena Forum