本文整理汇总了PHP中Checkout::getCheckoutJSOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Checkout::getCheckoutJSOptions方法的具体用法?PHP Checkout::getCheckoutJSOptions怎么用?PHP Checkout::getCheckoutJSOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Checkout
的用法示例。
在下文中一共展示了Checkout::getCheckoutJSOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
parent::run();
$assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets', false, -1, true);
$cs = Yii::app()->clientScript;
$cs->registerCssFile($assets . '/css/wsaddtocartmodal.css');
Yii::app()->clientScript->registerScript('instantiate checkout', sprintf('$(document).ready(function () {
checkout = new Checkout(%s);
});', Checkout::getCheckoutJSOptions()), CClientScript::POS_HEAD);
// No item added to cart.
if (empty($this->objCartItem)) {
return;
}
$this->objCart = Yii::app()->shoppingcart;
$this->intItemCount = Yii::app()->shoppingcart->totalItemCount;
$this->strItems = $this->intItemCount > 1 ? Yii::t('cart', 'items') : Yii::t('cart', 'item');
$arrItems = Yii::app()->shoppingcart->cartItems;
if (count($arrItems)) {
$this->intImageID = $this->objCartItem->Prod->image_id;
$dataProvider = $this->objCartItem->Prod->related();
$arrRel = $dataProvider->Data;
$dataProvider = $this->objCartItem->Prod->autoadd();
$arrAuto = $dataProvider->Data;
$arr = array_merge($arrAuto, $arrRel);
// right now we only want 3 related items at most
while (count($arr) > $this->intCountRelated) {
array_pop($arr);
}
$this->arrObjRelated = $arr;
} else {
$this->objCartItem = new CartItem();
// empty object
}
$this->render('addtocartmodal');
}
示例2: run
public function run()
{
parent::run();
$cs = Yii::app()->clientScript;
$this->assetUrl = $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
$cs->registerCssFile('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
$cs->registerCssFile($assets . '/css/wseditcartmodal.css');
$this->widget('ext.jquery-history-js.jqueryHistoryJs');
Yii::app()->clientScript->registerScript('instantiate checkout', sprintf('$(document).ready(function () {
checkout = new Checkout(%s);
});', Checkout::getCheckoutJSOptions()), CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScript('instantiate wsEditCartModal', sprintf('$(document).ready(function () {
wsEditCartModal = new WsEditCartModal(%s);
wsEditCartModal.checkout = checkout;
});', CJSON::encode(array('checkoutUrl' => Yii::app()->createUrl('checkout'), 'updateCartItemEndpoint' => Yii::app()->createUrl('cart/updatecartitem'), 'csrfToken' => Yii::app()->request->csrfToken, 'cartId' => CHtml::activeId('EditCart', 'promoCode'), 'invalidQtyMessage' => Yii::t('checkout', '<strong>Only {qty} are available at this time.</strong><br> If you’d like ' . 'to order more please return at a later time or contact us.')))), CClientScript::POS_HEAD);
$this->render('editcartmodal');
}
示例3: array
if (Yii::app()->user->isGuest) {
?>
<div class="account">
<h3><?php
echo Yii::t('checkout', "Save time");
?>
</h3>
<p>
<?php
echo Yii::t('checkout', "Shopped with us before?");
?>
<br>
<?php
echo CHtml::link(Yii::t('checkout', 'Login to your Account'), Yii::app()->createUrl('/checkout/index', array('showLogin' => 'true')));
?>
</p>
<p class="hint"><?php
echo Yii::t('checkout', "Don't have an account? You can create one after checkout.");
?>
</p>
</div>
<?php
}
?>
</div>
<?php
Yii::app()->clientScript->registerScript('instantiate checkout', sprintf('$(document).ready(function () {
checkout = new Checkout(%s);
});', Checkout::getCheckoutJSOptions()), CClientScript::POS_HEAD);