本文整理汇总了PHP中Shop::module方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::module方法的具体用法?PHP Shop::module怎么用?PHP Shop::module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: relations
public function relations()
{
$relations = array('customer' => array(self::BELONGS_TO, 'Customer', 'customer_id'), 'positions' => array(self::HAS_MANY, 'OrderPosition', 'order_id'), 'address' => array(self::BELONGS_TO, 'Address', 'address_id'), 'billingAddress' => array(self::BELONGS_TO, 'BillingAddress', 'billing_address_id'), 'deliveryAddress' => array(self::BELONGS_TO, 'DeliveryAddress', 'delivery_address_id'), 'paymentMethod' => array(self::BELONGS_TO, 'PaymentMethod', 'payment_method'), 'shippingMethod' => array(self::BELONGS_TO, 'ShippingMethod', 'shipping_method'));
if (Shop::module()->useWithYum) {
$relations['user'] = array(self::HAS_ONE, 'YumUser', 'user_id', 'through' => 'customer');
}
return $relations;
}
示例2: actionCreate
public function actionCreate()
{
// if some data has been entered before or the user is already logged in,
// take the already existing data and prefill the input form
if ($model = Shop::getCustomer()) {
$address = $model->address;
} else {
$model = new Customer();
}
if (isset($_POST['Customer'])) {
$model->attributes = $_POST['Customer'];
if (isset($_POST['Address'])) {
$address = new Address();
$address->attributes = $_POST['Address'];
if ($address->save()) {
$model->address_id = $address->id;
}
}
if (!Yii::app()->user->isGuest) {
$model->user_id = Yii::app()->user->id;
}
$model->validate();
if (Shop::module()->useWithYum && isset($_POST['register']) && ($_POST['register'] = true)) {
if (isset($_POST['Customer']['password']) && isset($_POST['Customer']['passwordRepeat'])) {
if ($_POST['Customer']['password'] != $_POST['Customer']['passwordRepeat']) {
$model->addError('password', Shop::t('Passwords do not match'));
} else {
if ($_POST['Customer']['password'] == '') {
$model->addError('password', Shop::t('Password is empty'));
} else {
$user = new YumUser();
$profile = new YumProfile();
$profile->attributes = $_POST['Customer'];
$profile->attributes = $_POST['Address'];
if ($user->register(strtr($model->email, array('@' => '_', '.' => '_')), $_POST['Customer']['password'], $profile)) {
$user->status = YumUser::STATUS_ACTIVE;
$user->save(false, array('status'));
$model->user_id = $user->id;
Shop::setFlash(Shop::t('Successfully registered user'));
} else {
$model->addErrors($user->getErrors());
$model->addErrors($profile->getErrors());
Shop::setFlash(Shop::t('Error while registering user'));
}
}
}
}
}
if (!$model->hasErrors()) {
if ($model->save()) {
Yii::app()->user->setState('customer_id', $model->customer_id);
$this->redirect(array('//shop/order/create', 'customer' => $model->customer_id));
}
}
}
$this->render('create', array('customer' => $model, 'address' => isset($address) ? $address : new Address()));
}
示例3: priceFormat
public static function priceFormat($price)
{
$price = sprintf('%.2f', $price);
if (Yii::app()->language == 'de') {
$price = str_replace('.', ',', $price);
}
$price .= ' ' . Shop::module()->currencySymbol;
return $price;
}
示例4: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$this->layout = Shop::module()->adminLayout;
$model = new ShippingMethod('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['ShippingMethod'])) {
$model->attributes = $_GET['ShippingMethod'];
}
$this->render('admin', array('model' => $model));
}
示例5: TCPDF
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('');
$pdf->SetTitle('');
$pdf->SetSubject('');
$pdf->SetKeywords('');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 006', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// ---------------------------------------------------------
// set font
$pdf->SetFont('dejavusans', '', 14);
// add a page
$pdf->AddPage();
$html = $this->renderPartial(Shop::module()->slipView, array('model' => $model), true, false);
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
$pdf->Output('slip.pdf', 'I');
示例6: sprintf
$variation = $variation[0];
} else {
$variation = ProductVariation::model()->findByPk($variation);
}
if (Shop::module()->allowPositionLiveChange) {
if ($specification->input_type == 'select') {
$name = sprintf('variation_%s_%s', $position, $specification->id);
$variations .= CHtml::radioButtonList($name, $variation->id, ProductVariation::listData($variation->getVariations(), true));
Yii::app()->clientScript->registerScript($name, "\r\n\t\t\t\t\t\t\t\t\t\t\$('[name=\"" . $name . "\"]').click(function(){\r\n\t\t\t\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\t\t\t\t\t'url' : '" . CController::createUrl('//shop/shoppingCart/updateVariation') . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'type' : 'POST',\r\n\t\t\t\t\t\t\t\t\t\t\t'data' : \$(this),\r\n\t\t\t\t\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_single_" . $position . "').load('" . $this->createUrl('//shop/shoppingCart/getPriceSingle?position=' . $position) . "');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\t\t\t\t\$('input:checked').trigger('click');\r\n\t\t\t\t\t\t\t\t\t\t");
$variations .= '<br />';
}
} else {
$variations .= $specification . ': ' . $variation . '<br />';
}
}
$img = CHtml::image(Yii::app()->baseUrl . '/' . $variation, '', array('width' => Shop::module()->imageWidthThumb));
}
}
printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class="text-right price_single_' . $position . '">%s</td><td class="text-right price_' . $position . '">%s</td><td>%s</td></tr>', $img, CHtml::textField('amount_' . $position, $product['amount'], array('size' => 4, 'class' => 'amount_' . $position)), $model->title, $variations, Shop::priceFormat($model->getPrice($product['Variations'])), Shop::priceFormat($model->getPrice($product['Variations'], $product['amount'])), CHtml::link(Shop::t('Remove'), array('//shop/shoppingCart/delete', 'id' => $position), array('confirm' => Shop::t('Are you sure?'))));
Yii::app()->clientScript->registerScript('amount_' . $position, "\r\n\t\t\t\t\t\$('.amount_" . $position . "').keyup(function() {\r\n\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\turl:'" . $this->createUrl('//shop/shoppingCart/updateAmount') . "',\r\n\t\t\t\t\t\t\tdata: \$('#amount_" . $position . "'),\r\n\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t},\r\n\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\t\t");
}
}
if ($shippingMethod = Shop::getShippingMethod()) {
printf('<tr>
<td></td>
<td>1</td>
<td>%s</td>
<td></td>
<td class="text-right shipping_costs">%s</td>
<td class="text-right shipping_costs">%s</td>
<td>%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->getPrice()), Shop::priceFormat($shippingMethod->getPrice()), CHtml::link(Shop::t('edit'), array('//shop/shippingMethod/choose')));
示例7: array
$positions[$j] = $j;
}
$str .= CHtml::dropDownList("Variations[{$i}][position]", $variation->position, $positions);
$str .= '</td></tr>';
return $str;
}
?>
<div class="form">
<?php
if (Shop::module()->rtepath !== false) {
Yii::app()->clientScript->registerScriptFile(Shop::module()->rtepath, CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScript("ckeditor", "\$('#Products_description').ckeditor();");
}
if (Shop::module()->rteadapter !== false) {
Yii::app()->clientScript->registerScriptFile(Shop::module()->rteadapter, CClientScript::POS_HEAD);
}
$form = $this->beginWidget('CActiveForm', array('id' => 'products-form', 'enableAjaxValidation' => true, 'htmlOptions' => array('enctype' => $model->hasUpload() ? 'multipart/form-data' : 'x-www-form-urlencoded')));
?>
<?php
echo $form->errorSummary($model);
?>
<fieldset>
<legend> <?php
echo Shop::t('Article Information');
?>
</legend>
<div class="row">
示例8: array
<?php
if (!isset($this->breadcrumbs)) {
$this->breadcrumbs = array(Shop::t('Shop'), Shop::t('already registered'));
}
?>
<?php
echo CHtml::link(Shop::t('I am a new customer'), array('//shop/order/create', 'customer' => 'new'));
echo '<br />';
echo CHtml::link(Shop::t('I am a customer already'), Shop::module()->loginUrl);
示例9: array
<p> <?php
echo Shop::t('Choose your delivery date');
?>
</p>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'Order[delivery_date]', 'value' => date(Shop::module()->dateFormat, time() + 3 * 86400), 'language' => Yii::app()->language, 'options' => array('showAnim' => 'fold', 'changeYear' => true, 'changeMonth' => true, 'closeText' => Shop::t('Apply'), 'minDate' => +3)));
?>
<p> <?php
echo Shop::t('Choose your preferred time');
?>
</p>
<?php
echo CHtml::dropDownList('Order[delivery_time]', 0, Shop::module()->deliveryTimes);
?>
<?php
}
?>
<?php
Yii::app()->clientScript->registerScript('toggle', "\r\n\t\tif(\$('#toggle_delivery').attr('checked'))\r\n\t\t\$('#delivery_information').show();\r\n\t\t\$('#toggle_delivery').click(function() { \r\n\t\t\t\$('#delivery_information').toggle(500);\r\n\t\t\t});\r\n\t\t");
?>
<div class="row buttons">
<?php
echo CHtml::submitButton(Shop::t('Continue'), array('id' => 'next'));
?>
</div>
示例10: array
echo $form->textField($address, 'city', array('size' => 32, 'maxlength' => 45));
?>
<?php
echo $form->error($address, 'city');
?>
</div>
<div class="row">
<?php
echo Shop::getCountryChooser($form, $address);
?>
</div>
<?php
if (Shop::module()->useWithYum && $customer->isNewRecord) {
?>
<?php
echo CHtml::label(Shop::t('Register an account'), 'register');
?>
<?php
echo CHtml::checkbox('register', true);
?>
<div class="registration">
<?php
echo Shop::t('Enter a password to create an user account');
?>
<div class="row">
<?php
示例11: array
<h2> <?php
echo Shop::t('Order');
?>
#<?php
echo $model->order_id;
?>
</h2>
<h3> <?php
echo Shop::t('Ordering Info');
?>
</h3>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('order_id', 'customer_id', 'comment', array('label' => Shop::t('Ordering Date'), 'value' => date('d. m. Y G:i', $model->ordering_date)), array('label' => Shop::t('Status'), 'value' => Shop::t($model->status)))));
if (Shop::module()->useWithYum && Yii::app()->user->isAdmin() || Yii::app()->user->id == 1) {
echo CHtml::link(Shop::t('Update order status'), array('//shop/order/update', 'id' => $model->order_id));
}
?>
<h3> <?php
echo Shop::t('Customer Info');
?>
</h3>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model->customer, 'attributes' => array('email')));
?>
<div class="summary_delivery_address">
<h3> <?php
示例12: array
}
$this->breadcrumbs = array(Yii::t('ShopModule.shop', 'Customers') => array('index'), Yii::t('ShopModule.shop', 'Register as a new Customer'));
?>
<h2> <?php
echo Shop::t('Please enter your Customer information');
?>
</h2>
<h3> <?php
echo Shop::t('I am a registered customer');
?>
</h3>
<p> <?php
echo Shop::t('Click {link} if you are already registered', array('{link}' => CHtml::link(Shop::t('here'), Shop::module()->loginUrl)));
?>
</p>
<hr />
<h3><?php
echo Shop::t('I am a new customer');
?>
</h3>
<p><?php
echo Shop::t('Registration information');
?>
</p>
<p><strong> <?php
echo Shop::t('Please enter your Customer information');
?>
示例13: array
$this->renderPartial('application.modules.shop.views.customer.view', array('model' => $customer, 'hideAddress' => true, 'hideEmail' => true));
echo '<br />';
echo '<hr />';
echo '<p>';
$shipping = ShippingMethod::model()->find('id = :id', array(':id' => Yii::app()->user->getState('shipping_method')));
echo '<strong>' . Shop::t('Shipping Method') . ': </strong>' . ' ' . $shipping->title . ' (' . $shipping->description . ')';
echo '<br />';
echo CHtml::link(Shop::t('Edit shipping method'), array('//shop/shippingMethod/choose', 'order' => true));
echo '</p>';
echo '<p>';
$payment = PaymentMethod::model()->findByPk(Yii::app()->user->getState('payment_method'));
echo '<strong>' . Shop::t('Payment method') . ': </strong>' . ' ' . $payment->title . ' (' . $payment->description . ')';
echo '<br />';
echo CHtml::link(Shop::t('Edit payment method'), array('//shop/paymentMethod/choose', 'order' => true));
echo '</p>';
echo '<hr />';
$this->renderPartial('application.modules.shop.views.shoppingCart.view');
echo '<h3>' . Shop::t('Please add additional comments to the order here') . '</h3>';
echo CHtml::textArea('Order[Comment]', @Yii::app()->user->getState('order_comment'), array('class' => 'order_comment'));
echo '<br /><br />';
echo '<hr />';
$this->renderPartial(Shop::module()->termsView);
?>
<div class="row buttons">
<?php
echo CHtml::submitButton(Shop::t('Confirm Order'), array('id' => 'next'), array('//shop/order/confirm'));
?>
</div>
<?php
echo CHtml::endForm();
示例14: array
<?php
if ($this->breadcrumbs) {
$this->breadcrumbs = array(Shop::t('Orders') => array('admin'), Shop::t('Manage'));
}
?>
<h2> <?php
echo Shop::t('Orders');
?>
</h2>
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'order-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('order_id', 'customer.address.firstname', 'customer.address.lastname', array('name' => 'ordering_date', 'value' => 'date(Shop::module()->dateFormat, $data->ordering_date)', 'filter' => false), array('name' => 'delivery_date', 'value' => 'date(Shop::module()->dateFormat, $data->delivery_date)', 'filter' => false, 'visible' => Shop::module()->deliveryTimes !== false), array('name' => 'delivery_time', 'value' => '$data->getDeliveryTime()', 'filter' => Shop::module()->deliveryTimes, 'visible' => Shop::module()->deliveryTimes !== false), array('name' => 'status', 'value' => 'Shop::t($data->status)', 'filter' => Order::statusOptions()), array('class' => 'CButtonColumn', 'template' => '{view}'))));
示例15: beforeAction
public function beforeAction($action)
{
$this->layout = Shop::module()->layout;
return parent::beforeAction($action);
}