Простор (prostore)

Поддержка шаблонов, продающихся на нашем сайте
ClayRabbit
Сообщения: 23
Зарегистрирован: 17.05.2022
Откуда: Тюмень
Спасибо: 6 раз
Контактная информация:

Простор (prostore)

Непрочитанное сообщение ClayRabbit »

По итогам запуска магазина на шаблоне простор, публикую небольшой модификатор с багфиксами и доработками для версии 1.2.0:

Код: Выделить всё

<?xml version="1.0" encoding="utf-8"?>
<modification>
  <name>z Prostore v1.2.0 fixes</name>
  <code>cr_prostore_fixes_1.2.0</code>
  <version>1.0</version>
  <author>Andrey Chesnakov</author>
  <email>clayrabbit2@gmail.com</email>
  <link>https://clayrabbit.ru</link>
  
  <!-- prostore_blog_mod: если выбрана категория блога ссылка "показать все" наверное должна вести в категорию -->
  <file path="catalog/controller/extension/module/prostore_blog_mod.php">
    <operation>
      <search><![CDATA[if($settings['main_category_id']){]]></search>
      <add position="after"><![CDATA[
$data['blog_href'] = $this->url->link('extension/module/prostorecat_blog/getcat&lbpath=' . $settings['main_category_id']);
      ]]></add>
    </operation>
  </file>

  <!-- [bugfix] Проверка наличия товара в корзине не учитывает опции. Пока просто игнорируем наличие таких товаров в корзине. -->
  <file path="system/library/themes899/helper.php">
    <operation>
      <search><![CDATA[if (array_key_exists($product_info['product_id'],$productsInCart)) {]]></search>
      <add position="after"><![CDATA[
if (!empty($productsInCart[$product_info['product_id']]['option'])) {
	$outData['isincart'] = false;
	return $outData;
}
      ]]></add>
    </operation>
  </file>

  <!-- [bugfix] Если в настройках выключен "Адрес доставки" (Выбор адреса доставки, отличного от платежного адреса), 
  то shipping_address не сохраняется и расчет доставки работает некорректно. (По крайней мере так происходило,
  если до этого адрес доставки заполнялся на странице товара для расчета стоимости доставки.) -->
  <file path="catalog/controller/checkout/payment_address.php">
    <operation>
      <search><![CDATA[$this->session->data['payment_address'] = $this->model_account_address->getAddress($this->request->post['address_id']);]]></search>
      <add position="after"><![CDATA[
if ($this->config->get('theme_prostore_checkout_st3_sa')) {
    $this->session->data['shipping_address'] = $this->session->data['payment_address'];
	unset($this->session->data['shipping_method']);
    unset($this->session->data['shipping_methods']);
}
      ]]></add>
    </operation>
    <operation>
      <search><![CDATA[$this->session->data['payment_address'] = $this->model_account_address->getAddress($address_id);]]></search>
      <add position="after"><![CDATA[
if ($this->config->get('theme_prostore_checkout_st3_sa')) {
    $this->session->data['shipping_address'] = $this->session->data['payment_address'];
	unset($this->session->data['shipping_method']);
    unset($this->session->data['shipping_methods']);
}
      ]]></add>
    </operation>
  </file>
<!-- [bugfix] Если в настройках выключен "Адрес доставки" то на странице информации о заказе не нужно его выводить -->  
  <file path="catalog/controller/account/order.php">
    <operation>
      <search><![CDATA[$data['shipping_method'] = $order_info['shipping_method'];]]></search>
      <add position="after"><![CDATA[
if ($this->config->get('theme_prostore_checkout_st3_sa')) {
	$data['payment_address'] = '';
}
      ]]></add>
    </operation>
  </file>
  
  <!-- Модуль prostore_brands предлагает вручную заполнять список брендов с картинками и ссылками, вместо того чтобы использовать данные производителей?
 	   Добавим автоматическую генерацию, если список в настройках оставлен пустым. -->
  <file path="catalog/controller/extension/module/prostore_brands.php">
    <operation>
      <search><![CDATA[if(isset($setting['brands_image'])){]]></search>
      <add position="before"><![CDATA[
if(empty($setting['brands_image'])){
	$this->load->model('catalog/manufacturer');
	foreach ($this->model_catalog_manufacturer->getManufacturers(array('sort' => 'sort_order')) as $_key => $_manufacturer) {
		if (!$_manufacturer['image']) continue;
		$data['banners'][$_key][] = array(
           'title' 			=> $_manufacturer['name'],
           'link'  			=> $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $_manufacturer['manufacturer_id']),
           'image' 			=> $this->model_tool_image->resize($_manufacturer['image'], $setting['width'], $setting['height']),
		);
	}
}
      ]]></add>
    </operation>
  </file>

  <!-- [bugfix] Модуль prostore_faq не сохраняет customer_id -->
  <file path="catalog/model/extension/module/prostore_faq.php">
    <operation>
      <search index="0"><![CDATA[$sql .= " text = '" . $this->db->escape(strip_tags($data['faq_text'])) . "', email = '" . $this->db->escape($data['faq_email']) . "',";]]></search>
      <add position="before"><![CDATA[
if ($this->customer->isLogged()) {
	$sql .= " customer_id = " . $this->customer->getId() . ",";
	if (empty($data['faq_email'])) {
		$data['faq_email'] = $this->customer->getEmail();
	}
}
      ]]></add>
    </operation>
  </file>
  
  <!-- Для модуля вопросов нужна возможность включения необходимости авторизации также как для отзывов -->
  <file path="catalog/controller/extension/module/prostore/prostore_theme.php">
    <operation>
      <search><![CDATA[$data['faqs'] = array();]]></search>
      <add position="before"><![CDATA[
if ($this->config->get('config_review_guest') || $this->customer->isLogged()) {
    $data['review_guest'] = true;
} else {
    $data['review_guest'] = false;
	$data['text_login'] = sprintf($this->language->get('text_login'), $this->url->link('account/login', '', true), $this->url->link('account/register', '', true));
}
      ]]></add>
    </operation>
    <operation>
      <search><![CDATA[if ($this->config->get('captcha_' . $this->config->get('theme_prostore_product_faq')['captcha'] . '_status')) {]]></search>
      <add position="before"><![CDATA[
if (!$this->config->get('config_review_guest') AND !$this->customer->isLogged()) {
    $json['error'] = sprintf($this->language->get('text_login'), $this->url->link('account/login', '', true), $this->url->link('account/register', '', true));
}
      ]]></add>
    </operation>	
  </file>
  
</modification>
(Некоторые из этих доработок потребуют также правок twig-шаблона.)

Еще немного фиксов для app.js:

Код: Выделить всё

--- catalog/view/javascript/prostore/app.js~orig	2023-10-16 10:26:11.452309900 +0500
+++ catalog/view/javascript/prostore/app.js	2023-10-16 10:53:41.402291900 +0500
@@ -2498,7 +2498,8 @@
 
 function alertClose(alert) {
 	$(alert).closest('.alert').addClass('is-hide').on('animationend',function(){
-		$(alert).remove();
+        // Вероятно должен удаляться весь блок, а не только кнопка.
+		$(this).remove();
 	});	
 }
 
@@ -3618,7 +3619,8 @@
 				if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout' || $('.cart__content').length) {  
 					location = 'index.php?route=checkout/cart';
 				} else {
-					$('#cart .header__cart-load').load('index.php?route=common/cart/info .header__cart-offcanvas',function(){
+                    // Чтобы не терялась позиция скролла в корзине при обновлении количества
+                    $('#cart .header__cart-load .js-cart-scrollbar').load('index.php?route=common/cart/info .header__cart-offcanvas .js-cart-scrollbar > *',function(){
 						hasScrollBar();
 						$('[data-fancybox]').fancybox(fancyboxOptions);
 					});				
@@ -3754,7 +3756,8 @@
 					location = json['redirect'];
 				}
 
-				var elem = $('.products__item, #product').find("button[data-for='"+product_id+"']").filter("[data-action='wishlist']");
+                // Чтобы обновление иконок избранного работало и на странице сравнения
+				var elem = $('.products__item, .compare__item, #product').find("button[data-for='"+product_id+"']").filter("[data-action='wishlist']");
 
 				if(json['error'] != 1){
 					elem.addClass('is-active');
@@ -3785,7 +3788,8 @@
 			success: function(json) {
 				$('.alerts-wrapper').remove();
 
-				var elem = $('.products__item, #product').find("button[data-for='"+product_id+"']").filter("[data-action='wishlist']");
+                // Чтобы обновление иконок избранного работало и на странице сравнения
+				var elem = $('.products__item, .compare__item, #product').find("button[data-for='"+product_id+"']").filter("[data-action='wishlist']");
 
 				if(json['error'] != 1){
 					elem.removeClass('is-active');


Лично для меня основным минусом шаблона была слабая поддержка опций (впрочем, наверное мало какой шаблон может похвастаться полноценной их поддержкой).

И еще несколько вопросов/пожеланий:
  • После отправки вопроса (на странице товара) не надо очищать поле с именем. Если у покупателя второй вопрос родится - зачем снова заполнять имя? Достаточно очистки поля с текстом.
  • При оформлении заказа зарегистрированным пользователем телефон присутствует в форме нового адреса но нигде не сохраняется.
  • На странице контактов на карте было бы хорошо для меток добавить балуны с информацией о магазине и кластеризацию меток включить (иначе в масштабе страны сливаются метки 2+ магазинов в одном городе).
ClayRabbit
Сообщения: 23
Зарегистрирован: 17.05.2022
Откуда: Тюмень
Спасибо: 6 раз
Контактная информация:

Re: Простор (prostore)

Непрочитанное сообщение ClayRabbit »

Еще один багфикс

Код: Выделить всё

    <!-- prostorecat_blog: забыли подключить обработку кастомных макетов -->
  	<file path="catalog/controller/common/{column_*,content_bottom,content_top}.php">
		<operation>
			<search><![CDATA['information/information']]></search>
			<add position="before"><![CDATA[
if ($route == 'extension/module/prostorecat_blog/getcat' && isset($this->request->get['lbpath'])) {
	$this->load->model('extension/module/prostorecatblog');

	$lbpath = explode('_', (string)$this->request->get['lbpath']);

	$layout_id = $this->model_extension_module_prostorecatblog->getBlogCategoryLayoutId(end($lbpath));
}
			]]></add>
		</operation>
	</file>
Ответить