-
Notifications
You must be signed in to change notification settings - Fork 61
Updates to checkout.php for Web Store 3.2.2
As part of Web Store 3.2.2 we made some changes to the single-page checkout code. Custom themes with a modified checkout.php should be updated to use the new code. Stores using a stock theme and themes that do not override checkout.php are unaffected.
We recommend against customizing the checkout. For more information see https://github.com/lightspeedretail/webstore/wiki/Checkout
Backwards compatibility for customized themes has been included in 3.2.2 and will be removed in 3.2.3. Custom themes containing checkout.php should be updated before upgrading to 3.2.3.
The following changes are required to update checkout.php:
-
Find references to:
updateShippingAuto()
And replace with:
singlePageCheckout.updateShippingAuto()
-
Find references to:
updateTax(data):
And replace with:
singlePageCheckout.updateTax(data)
-
Find references to:
updateCart(this.value)
And replace with:
singlePageCheckout.updateCart(this.value)
-
Find references to:
changePayment(this.value)
And replace with:
singlePageCheckout.changePayment(this.value)
-
Find references to:
updateShippingPriority(this.value)
And replace with:
singlePageCheckout.pickShippingProvider(this.value)
-
Find the following section:
<?php echo CHtml::ajaxButton ( Yii::t('checkout','Calculate Shipping'), array('cart/ajaxcalculateshipping'), array('type'=>"POST", 'dataType'=>'json', 'data'=>'js:jQuery($("#checkout")).serialize()', 'onclick'=>'js:jQuery($("#shippingSpinner")).show(), js:jQuery($("#' . CHtml::activeId( $model, 'shippingProvider') .'")).html(\'\'), js:jQuery($("#' . CHtml::activeId( $model, 'shippingPriority') .'")).html(\'\')', 'success' => 'js:function(data){ if (data.result=="error") alert(data.errormsg); savedShippingProviders = data.provider; savedShippingPrices = data.prices; savedTaxes = data.taxes; savedTotalScenarios = data.totals; savedShippingPriorities = data.priority; savedCartScenarios = data.cartitems; savedPickedModule = $("#' . CHtml::activeId( $model, 'paymentProvider') .'").val(); $("#' . CHtml::activeId( $model, 'shippingProvider') .'").html(data.provider); $("#' . CHtml::activeId( $model, 'shippingPriority') .'").html(data.priority); $("#' . CHtml::activeId( $model, 'paymentProvider') .'").html(data.paymentmodules); $("#' . CHtml::activeId( $model, 'paymentProvider') .'").val(savedPickedModule); $("#shippingSpinner").hide(); $("#shippingProvider_0").click(); }', ), array('id'=>'btnCalculate')); ?>
And replace with:
<input type="button" id="btnCalculate" value="<?= CHtml::encode(Yii::t('checkout', 'Calculate Shipping')); ?>"> <?php Yii::app()->clientScript->registerScript( 'btnCalculate-script', '$("#btnCalculate").click(singlePageCheckout.calculateShipping.bind(singlePageCheckout))', CClientScript::POS_LOAD ); ?>
-
At the end of the file replace
//Render javascript echo $this->renderPartial('/cart/_cartjs',array('model'=>$model),true);
With
$this->renderPartial( 'ext.wssinglepagecheckout.views.instantiate', array( 'model' => $model ) );