예제 #1
0
 public static function PopulateProductViewModelList($products)
 {
     for ($i = 0; $i < count($products); $i++) {
         $models[$i] = ProductHelper::PopulateProductViewModel($products[$i]);
     }
     return $models;
 }
예제 #2
0
 function action_remove()
 {
     session_start();
     $model = $_SESSION['basket'];
     $productId = $_POST['productId'];
     $model->Remove(ProductHelper::PopulateProductViewModel(ProductService::GetById($productId)));
     $_SESSION['basket'] = $model;
 }
예제 #3
0
 public static function GetProductsByOrderId($order_id)
 {
     $orders = OrderListService::GetByOrderId($order_id);
     for ($i = 0; $i < count($orders); $i++) {
         $products[$i] = ProductHelper::PopulateProductViewModel(ProductService::GetById($orders[$i]->product_id));
     }
     return $products;
 }
예제 #4
0
 /**
  * @param Event $event
  */
 public static function onGenerate(Event $event)
 {
     $generator = $event->getGenerator();
     $provider = new CActiveDataProvider(Product::model()->published());
     foreach (new CDataProviderIterator($provider) as $item) {
         $generator->addItem(ProductHelper::getUrl($item, true), strtotime($item->update_time), SitemapHelper::FREQUENCY_DAILY, 0.5);
     }
 }
예제 #5
0
 public static function PopulateReviewViewModel($review)
 {
     $model = new ReviewViewModel();
     $model->id = $review->review_id;
     $model->product = ProductHelper::PopulateProductViewModel(ProductService::GetById($review->product_id));
     $model->account = AccountHelper::PopulateAccountViewModel(AccountService::GetById($review->account_id));
     $model->value = $review->value;
     return $model;
 }
예제 #6
0
파일: _product.php 프로젝트: yupe/yupe
            <a href="<?php 
echo ProductHelper::getUrl($data);
?>
">
                <img src="<?php 
echo $data->getImageUrl(190, 190, false);
?>
"/>
            </a>
        </div>
        <div class="info separator">
            <div class="row">
                <div class="price col-sm-12">
                    <h5>
                        <a href="<?php 
echo ProductHelper::getUrl($data);
?>
"><?php 
echo CHtml::encode($data->getName());
?>
</a>
                    </h5>
                    <h5 class="price-text-color">
                        <?php 
echo $data->getResultPrice();
?>
 <?php 
echo Yii::t("StoreModule.store", Yii::app()->getModule('store')->currency);
?>
                    </h5>
                </div>
예제 #7
0
 /**
  * Get product information
  *
  * @return array
  */
 public function getProductInfo()
 {
     return ProductHelper::formatData($this->_productData);
 }
예제 #8
0
            </td>
        </tr>
    <?php 
}
?>
</table>

<h1 style="font-weight:normal;">Покупатель заказал:</h1>

<table cellpadding="6" cellspacing="0" style="border-collapse: collapse;">

    <?php 
foreach ($order->products as $orderProduct) {
    ?>
        <?php 
    $productUrl = ProductHelper::getUrl($orderProduct->product, true);
    ?>
        <tr>
            <td align="center"
                style="padding:6px; width:100; padding:6px; background-color:#ffffff; border:1px solid #e0e0e0;">
                <?php 
    if ($orderProduct->product) {
        ?>
                    <a href="<?php 
        echo $productUrl;
        ?>
">
                        <?php 
        if ($orderProduct->product->image) {
            ?>
                            <img border="0" src="<?php 
예제 #9
0
파일: Product.php 프로젝트: yupe/yupe
 /**
  * @return mixed
  */
 public function getLink()
 {
     return ProductHelper::getUrl($this);
 }
예제 #10
0
파일: default.php 프로젝트: yupe/yupe
                                             class="product-mini__img"
                                             alt="<?php 
    echo CHtml::encode($product->getImageAlt());
    ?>
"
                                             title="<?php 
    echo CHtml::encode($product->getImageTitle());
    ?>
"
                                            >
                                    </a>
                                </div>
                                <div class="product-mini__info">
                                    <div class="product-mini__title">
                                        <a href="<?php 
    echo ProductHelper::getUrl($product);
    ?>
" class="product-mini__link">
                                            <?php 
    echo CHtml::encode($product->getName());
    ?>
                                        </a>
                                    </div>
                                    <div class="product-mini__price">
                                        <div class="product-price">
                                            <?php 
    echo $product->getResultPrice();
    ?>
                                            <span class="ruble"> <?php 
    echo Yii::t('StoreModule.store', Yii::app()->getModule('store')->currency);
    ?>
예제 #11
0
파일: view.php 프로젝트: yupe/yupe
echo $model->shop_cpa;
?>
</cpa>
    <offers>
        <?php 
foreach ($offers as $offer) {
    ?>
            <offer id="<?php 
    echo $offer->id;
    ?>
" type="vendor.model" available="<?php 
    echo $offer->isInStock() ? 'true' : 'false';
    ?>
">
                <url><?php 
    echo CHtml::normalizeUrl(Yii::app()->getBaseUrl(true) . ProductHelper::getUrl($offer));
    ?>
</url>
                <price><?php 
    echo $offer->getResultPrice();
    ?>
</price>
                <oldprice><?php 
    echo $offer->getBasePrice();
    ?>
</oldprice>
                <currencyId><?php 
    echo Yii::app()->getModule('store')->currency;
    ?>
</currencyId>
                <categoryId><?php 
예제 #12
0
                        <td><?php 
echo round($product->weight, 2);
?>
 <?php 
echo Yii::t("StoreModule.store", "kg");
?>
</td>
                    </tr>
                </table>
            </div>
            <?php 
if (Yii::app()->hasModule('comment')) {
    ?>
                <div class="tab-pane" id="comments-tab">
                    <?php 
    $this->widget('application.modules.comment.widgets.CommentsWidget', ['redirectTo' => ProductHelper::getUrl($product), 'model' => $product]);
    ?>
                </div>
            <?php 
}
?>
        </div>
    </div>
    <div class="col-sm-12">
        <?php 
$this->widget('application.modules.store.widgets.LinkedProductsWidget', ['product' => $product, 'code' => null]);
?>
    </div>
</div>

<?php 
예제 #13
0
파일: view.php 프로젝트: yupe/yupe
?>
            <small>[<?php 
echo CHtml::encode($model->getStatusTitle());
?>
]</small>
        </h1>
        <table class="table">
            <tbody>
            <?php 
foreach ((array) $model->products as $position) {
    ?>
                <tr>
                    <td class="col-sm-5">
                        <div class="media">
                            <?php 
    $productUrl = ProductHelper::getUrl($position->product);
    ?>
                            <a class="img-thumbnail pull-left" href="<?php 
    echo $productUrl;
    ?>
">
                                <img class="media-object" src="<?php 
    echo $position->product->getImageUrl(72, 72);
    ?>
">
                            </a>

                            <div class="media-body">
                                <h4 class="media-heading">
                                    <a href="<?php 
    echo $productUrl;
예제 #14
0
}], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link(\yupe\helpers\YText::wordLimiter($data->name, 5), ["/store/productBackend/update", "id" => $data->id]);
}], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'sku', 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'sku', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'producer_id', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => CMap::mergeArray(['' => '---'], Producer::model()->getFormattedList()), 'editable' => ['emptytext' => '---']], ['name' => 'category_id', 'value' => function ($data) {
    $categoryList = '<span class="label label-primary">' . (isset($data->category) ? $data->category->name : '---') . '</span>';
    foreach ($data->categories as $category) {
        $categoryList .= '<br>' . $category->name;
    }
    return $categoryList;
}, 'type' => 'raw', 'filter' => CHtml::activeDropDownList($model, 'category_id', StoreCategoryHelper::formattedList(), ['encode' => false, 'empty' => '', 'class' => 'form-control']), 'htmlOptions' => ['width' => '220px']], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'price', 'value' => function (Product $data) {
    return round($data->getBasePrice(), 2);
}, 'editable' => ['url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'price', ['class' => 'form-control'])], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'discount_price', 'header' => Yii::t('StoreModule.store', 'New price'), 'value' => function (Product $data) {
    return round($data->getDiscountPrice(), 2);
}, 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'discount_price', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'in_stock', 'header' => Yii::t('StoreModule.store', 'Availability'), 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getInStockList(), 'options' => [Product::STATUS_IN_STOCK => ['class' => 'label-success'], Product::STATUS_NOT_IN_STOCK => ['class' => 'label-danger']]], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'quantity', 'value' => function (Product $data) {
    return $data->quantity;
}, 'header' => Yii::t('StoreModule.store', 'Rest'), 'editable' => ['url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'price', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getStatusList(), 'options' => [Product::STATUS_ACTIVE => ['class' => 'label-success'], Product::STATUS_NOT_ACTIVE => ['class' => 'label-info'], Product::STATUS_ZERO => ['class' => 'label-default']]], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'frontViewButtonUrl' => function ($data) {
    return ProductHelper::getUrl($data);
}, 'buttons' => ['front_view' => ['visible' => function ($row, $data) {
    return $data->status == Product::STATUS_ACTIVE;
}]]]]]);
?>

<?php 
$url = Yii::app()->createUrl('/store/productBackend/copy');
$tokenName = Yii::app()->getRequest()->csrfTokenName;
$token = Yii::app()->getRequest()->csrfToken;
Yii::app()->getClientScript()->registerScript(__FILE__, <<<JS
    \$('body').on('click', '#copy-products', function (e) {
        e.preventDefault();
        var checked = \$.fn.yiiGridView.getCheckedRowsIds('product-grid');
        if (!checked.length) {
            alert('No items are checked');
예제 #15
0
 function action_detail()
 {
     $tovarId = $_GET['tovarId'];
     if (!is_null($tovarId)) {
         $this->view->generate('/Product/detail_view.php', 'template_view.php', ProductHelper::PopulateProductViewModel(ProductService::GetById($tovarId)));
     } else {
         header("Location: /main/index");
     }
 }
예제 #16
0
파일: index.php 프로젝트: yupe/yupe
                    <div class="cart-list__column"><?php 
    echo Yii::t("CartModule.cart", "Sum");
    ?>
</div>
                </div>
            </div>
            <div class="cart-list">
                <?php 
    foreach ($positions as $position) {
        ?>
                    <div class="cart-list__item">
                        <?php 
        $positionId = $position->getId();
        ?>
                        <?php 
        $productUrl = ProductHelper::getUrl($position->getProductModel());
        ?>
                        <?php 
        echo CHtml::hiddenField('OrderProduct[' . $positionId . '][product_id]', $position->id);
        ?>
                        <input type="hidden" class="position-id" value="<?php 
        echo $positionId;
        ?>
"/>

                        <div class="cart-item js-cart__item">
                            <div class="cart-item__info">
                                <div class="cart-item__thumbnail">
                                    <img src="<?php 
        echo $position->getProductModel()->getImageUrl(90, 90, false);
        ?>
예제 #17
0
파일: shoppingCart.php 프로젝트: yupe/yupe
    foreach (Yii::app()->cart->getPositions() as $product) {
        ?>
                        <?php 
        $price = $product->getResultPrice();
        ?>
                        <div class="cart-mini__item js-cart__item">
                            <div class="cart-mini__thumbnail">
                                <img src="<?php 
        echo $product->getImageUrl(60, 60, false);
        ?>
" class="cart-mini__img"/>
                            </div>
                            <div class="cart-mini__info">
                                <div class="cart-mini__title">
                                    <?php 
        echo CHtml::link($product->title, ProductHelper::getUrl($product), ['class' => 'cart-mini__link']);
        ?>
                                </div>
                                <div class="cart-mini__base-price">
                                    <?php 
        echo $price;
        ?>
                                    <span class="ruble"><?php 
        echo Yii::t('CartModule.cart', $currency);
        ?>
</span>
                                    x <?php 
        echo $product->getQuantity();
        ?>
 <?php 
        echo Yii::t('CartModule.cart', 'pcs');