Корзина пуста

Документация

Скачать код модуля

1. В панели администрирования добавить новый вид доставки, например eShopLogistic.
В редакторе в режиме исходного кода добавить:
<p>тут текст описания</p><div id="delivery_eshoplogistic"></div>
<script  src="/deliveries/eshoplogistic/script.js"></script>
<p><link href="/deliveries/eshoplogistic/style.css" rel="stylesheet" type="text/css" media="screen" /></p>


2. В свойствах товара добавить свойства:

Вес посылки, кг
Длина посылки, см
Ширина посылки, см
Высота посылки, см

Запомнить их ID, при необходимости поменять в файле /api/Cart.php: 55 - 65 стр


3. В файле /api/Cart.php добавлен код: 52 - 67 стр

$features = $this->features->get_product_options(array('product_id'=>$p->id));
foreach ($features as $feature) {
    if ($feature->feature_id == 149) {// тут указать ID опции с весом
        $products[$p->id]->weight = (float)str_replace(',', '.', $feature->value);
    }
    if ($feature->feature_id == 150) {// длина
        $products[$p->id]->length = (int)str_replace(',', '.', $feature->value);
    }
    if ($feature->feature_id == 151) {// ширина
        $products[$p->id]->width = (int)str_replace(',', '.', $feature->value);
    }
    if ($feature->feature_id == 152) {// высота
        $products[$p->id]->height = (int)str_replace(',', '.', $feature->value);
    }
}

и 84 - 88 стр:

 $purchase->weight = $purchase->product->weight;
$purchase->length = $purchase->product->length;
$purchase->width = $purchase->product->width;
$purchase->height = $purchase->product->height;


4. В шаблоне корзины /design/default/html/cart.tpl
замена:

{foreach $cart->purchases as $purchase}
<tr>


на:

{foreach $cart->purchases as $purchase}
<tr class="row_product" data-variant_id="{$purchase->variant->id}">



5. Добавлены скрытые поля формы

<input type="hidden" id="product_weight_{$purchase->variant->id}" value="{$purchase->weight}" />
<input type="hidden" id="product_length_{$purchase->variant->id}" value="{$purchase->length}" />
<input type="hidden" id="product_width_{$purchase->variant->id}" value="{$purchase->width}" />
<input type="hidden" id="product_height_{$purchase->variant->id}" value="{$purchase->height}" />


6. В файле /view/CartView.php: 112 - 126 стр. добавлен код

if (file_exists($_SERVER["DOCUMENT_ROOT"].'/deliveries/eshoplogistic/class_delivery.php')) {
    require_once($_SERVER["DOCUMENT_ROOT"].'/deliveries/eshoplogistic/class_delivery.php');
    $code = $this->request->post('eshoplogistic_delivery_code');
    $to = $this->request->post('eshoplogistic_delivery_to');
    $service = $this->request->post('eshoplogistic_delivery_service');
    if (!$code || !$to || !$service) {
        $this->design->assign('error', 'delivery');
        return;
    }
    $data = delivery_eshop_logistic::get_delivery($this->request, $service, $to, $code);
    if (is_array($data)) {
        $this->orders->update_order($order->id, array('delivery_price'=>$data['price'], 'comment' => $data['note'].$order->comment));
    }
}