How to force default xx_hikashop_cart table cart_payment_id to 0

  • Posts: 22
  • Thank you received: 0
7 years 2 months ago #277821

-- url of the page with the problem -- : www.bikehome.com.tw
-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.5.9

cart_payment_id default is 0

While product add to cart and choosing payment method , cart_payment_id will set to its id (not 0)
If quit the checkout progress , cart_payment_id not reset to 0.
How can I add php code force cart_payment_id:0 while open checkout progress ??

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
7 years 2 months ago #277833

Hi,

The payment method is automatically preselected when the cart is loaded, whether it's on the checkout or another page which displays the cart.
Even if you set it to 0, the loading function of the cart will re-set it to the default payment method id.
So you would have to modify the "getFullCart" function of the file administrator/components/com_hikashop/classes/cart.php to load set the payment_id when not already set.
However, this might lead to some erratic behavior as the new cart and checkout system introduced in HikaShop 3 has been made with the intent of auto selecting the payment method like that in order to avoid many issues that plagued previous versions of the checkout because of that.
I would personnally advise not changing that and try to see if you can't do something else for your problematic.

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

  • Posts: 22
  • Thank you received: 0
7 years 2 months ago #277906

My condition is

Customer has add product into cart and click checkout into the checkout process
If the customer choose one payment method and quit the checkout .
The cart_payment_id will set to the payment method.
If the customer add another product to the shopping cart and go to the checkout process again
The last choice cart_payment_id will load .

I don't want to load the last choice cart_payment_id. I wish the cart_payment_id will be 0

Where can I add the cart_payment_id=0 ??
Could I using mysql trigger instead of modify the hikashop core ??

Many Thanks!!

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
7 years 2 months ago #277933

Hi,

I don't see how the default behavior of the system is different from your needs ?
By default, when you add a product to the cart and go to the checkout a default payment method will be preselected in the cart_payment_id, however, the customer will still be able to change it if he wants on the checkout and that change will be saved in his cart.
If he comes back later on and add another product to the cart and go to the checkout, the previously selected payment method will still be selected and the customer will still be able to choose another one if he wants to.
So why would you want to set the cart_payment_id to 0 ? and at which point in the process ?
You could use one of the triggers called during the loading of the cart I guess... However, I've never done that so I can't guarantee anything.
www.hikashop.com/support/documentation/6...fterCartProductsLoad

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

Time to create page: 0.060 seconds
Powered by Kunena Forum