Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

alexst

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

alexst's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Для нашего интернет-магазина появилась потребность в виджете ПЭКа, который рассчитывает стоимость и сроки доставки. При этом нам не хотелось добавлять эти данные в заказ, но нужно было чтобы клиент сам мог ознакомиться со стоимостью доставки. Предлагаю вашему вниманию альтернативу платному модулю ПЭКа. Сам информер взят отсюда, но сделаны некоторые модификации, чтобы объем и масса брались из карточки товара. Работает на OC 2.3 (на других - не проверялось). Пример магазина с таким виджетом - здесь. Город доставки определяется автоматически. 1. Необходимо вставить в /catalog/controller/product/product.php после $data['points'] = $product_info['points']; следующий код: $data['weight'] = $this->weight->format($product_info['weight'], $product_info['weight_class_id']); $data['length'] = $this->length->format($product_info['length'], $product_info['length_class_id']); $data['width'] = $this->length->format($product_info['width'], $product_info['length_class_id']); $data['height'] = $this->length->format($product_info['height'], $product_info['length_class_id']); 2. В файл /catalog/view/theme/default2/template/product/product.tpl (вместо default2 - папка с вашей темой) добавляем в нужно нам место следующее: <script> var pec_goods = [], pec_informer_size = "horizontal", // тип информера pec_from = "-483", // город отправки pec_to = "auto", // город доставки pec_insurance = "", // сумма для страхования pec_packing = ""; // тип упаковки var pec_goods_my = "<?php if(empty($length)){echo " x ";}else{echo $length;}?>/<?php if(empty($width)){echo " x ";}else{echo $width;}?>/<?php if(empty($height)){echo " x ";}else{echo $height;}?><?php if ($weight > 0) { ?>/<?php echo $weight;} ?>"; // габариты, объем, вес var test = ''; pec_goods_my.split("/").forEach(function(item, i, arr) { test = test.replace(",", ''); test += item.substr(0, item.length - 2) + '/'; }); var test = test.split("/"); pec_goods[0] = ''; for (var i = 0; i < 3; i++) { test[i] = test[i] / 1000; pec_goods[0] += test[i] + '/'; } pec_goods[0] += (test[0] * test[1] * test[2]) + "/" + test[3]; console.log(pec_goods[0]); </script><script src="https://pecom.ru/business/developers/js_informer/get_informer.js" charset="utf-8"></script> В моем случае я добавил код после <div class="addthis_inline_share_toolbox"></div>, чтобы виджет отображался сразу после AddThis. Также необходимо изменить город отправки, указав в строке pec_from нужное значение. Получить его можно здесь. Для Москвы: pec_from = "-446" 3. В товарах необходимо добавить информацию о размере упаковки товара и весе. Размер указывается в миллиметрах. Пример: 4. После редактирования имеет смысл почистить кеш сайта. Принимаем критику.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.