- Posts: 45
- Thank you received: 0
Step 1 in checkout is repeated
- paulvanharen
-
Topic Author
- Offline
Less
More
11 years 3 months ago #204562
by paulvanharen
Step 1 in checkout is repeated was created by paulvanharen
-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.4
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Chrome
Hi,
I've made my own payment plugin that selects a payment method and issuer in the payment selection pane. When I accept my choices and press the 'finish' button, the same page reappears. Pressing 'finish' once more takes me to the redirect to payment service provider page.
While debugging this issue I found in checkout.php the following snippet that plays an important role here (lines 1187 and further)
My workaround is to preload the $app->getUserState(HIKASHOP_COMPONENT.'.payment_method'); and $app->getUserState(HIKASHOP_COMPONENT.'.payment_id'); in the plugin's onPaymentSave() method in the following manner:
This workaround seems to be OK, but I'm wondering what the purpose of the check in checkout is and whether such a workaround is needed.
Your thoughts are appreciated, as always.
Best regards, Paul
-- Joomla version -- : 3.4
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Chrome
Hi,
I've made my own payment plugin that selects a payment method and issuer in the payment selection pane. When I accept my choices and press the 'finish' button, the same page reappears. Pressing 'finish' once more takes me to the redirect to payment service provider page.
While debugging this issue I found in checkout.php the following snippet that plays an important role here (lines 1187 and further)
Code:
$app = JFactory::getApplication();
$old_payment_method = $app->getUserState(HIKASHOP_COMPONENT.'.payment_method');
$old_payment_data = $app->getUserState(HIKASHOP_COMPONENT.'.payment_data');
$old_payment_id = $app->getUserState(HIKASHOP_COMPONENT.'.payment_id');
$app->setUserState( HIKASHOP_COMPONENT.'.payment_method',$payment);
$app->setUserState( HIKASHOP_COMPONENT.'.payment_id',$payment_id);
$price_all = @$cart->full_total->prices[0]->price_value_with_tax;
if(isset($cart->full_total->prices[0]->price_value_without_payment_with_tax)){
$price_all = @$cart->full_total->prices[0]->price_value_without_payment_with_tax;
}
$currencyClass = hikashop_get('class.currency');
$currencyClass->convertPayments($rates);
$paymentData->payment_price = ($price_all * (float)@$paymentData->payment_params->payment_percentage / 100) + $paymentData->payment_price;
$app->setUserState( HIKASHOP_COMPONENT.'.payment_data',$paymentData);
if(!empty($paymentData->ask_cc)){
$paymentClass = hikashop_get('class.payment');
if(!$paymentClass->readCC()){
return false;
}
}
if(($old_payment_id!=$payment_id || $old_payment_method!=$payment) || @$old_payment_data->payment_price!=$paymentData->payment_price && ($this->_getStep('cart',(int)$this->previous)===(int)$this->previous || $this->_getStep('confirm',(int)$this->previous)===(int)$this->previous)){
return false;
}
Code:
$app = JFactory::getApplication();
$app->setUserState( HIKASHOP_COMPONENT.'.payment_id',$payment_id);
$app->setUserState( HIKASHOP_COMPONENT.'.payment_method','mypayment');
This workaround seems to be OK, but I'm wondering what the purpose of the check in checkout is and whether such a workaround is needed.
Your thoughts are appreciated, as always.
Best regards, Paul
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
11 years 3 months ago #204578
by Mohamed Thelji
Replied by Mohamed Thelji on topic Step 1 in checkout is repeated
Hello Paul,
Firstly can you show me how did you configured the page "Hikahsop->System->Configuration->Checkout" through some screenshots ?
Thanks.
Firstly can you show me how did you configured the page "Hikahsop->System->Configuration->Checkout" through some screenshots ?
Thanks.
Please Log in or Create an account to join the conversation.
- paulvanharen
-
Topic Author
- Offline
Less
More
- Posts: 45
- Thank you received: 0
11 years 3 months ago #204581
by paulvanharen
Replied by paulvanharen on topic Step 1 in checkout is repeated
Hi Mohamed,
Please find attached.
Thanks, Paul.
Please find attached.
Thanks, Paul.
Please Log in or Create an account to join the conversation.
11 years 3 months ago #204585
by nicolas
Replied by nicolas on topic Step 1 in checkout is repeated
Hi,
You turned off the "auto select shipping and payment methods" and the "auto submit payment and shipping methods selection" settings there.
That's probably why you get that behavior and your code just does what these option do.
You turned off the "auto select shipping and payment methods" and the "auto submit payment and shipping methods selection" settings there.
That's probably why you get that behavior and your code just does what these option do.
Please Log in or Create an account to join the conversation.
Time to create page: 0.201 seconds