Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Malhaz

Користувачі
  
  • Публікації

    52
  • З нами

  • Відвідування

Повідомлення, опубліковані користувачем Malhaz

  1. 17.03.2023 в 14:52, Tom сказал:
    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
       <name>Filter Name</name>
       <code>Filter Name</code>
       <version>1.0</version>
       <author>Filter Name</author>
       <link>Filter Name</link>
       <file path="admin/view/template/sale/order_list.twig">
          <operation>
             <search index="0"><![CDATA[<div class="form-group">]]></search>
             <add position="before"><![CDATA[<div class="form-group">
                    <label class="control-label" for="input-filter-name">Наименование товара</label>
                    <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="Наименование товара" id="input-filter-name" class="form-control" />
                </div>]]></add>
          </operation>
          <operation>
             <search><![CDATA[var filter_order_id = $('input[name=\'filter_order_id\']').val();]]></search>
             <add position="after"><![CDATA[var filter_name = $('input[name=\'filter_name\']').val();
    if (filter_name) {
        url += '&filter_name=' + encodeURIComponent(filter_name);
    }]]></add>
          </operation>
       </file>
       <file path="admin/controller/sale/order.php">
          <operation>
             <search><![CDATA[protected function getList() {]]></search>
             <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
        $filter_name = $this->request->get['filter_name'];
    } else {
        $filter_name = null;
    }]]></add>
          </operation>
          <operation>
             <search><![CDATA['filter_order_id'        => $filter_order_id,]]></search>
             <add position="before"><![CDATA['filter_name'          => $filter_name,]]></add>
          </operation>
          <operation>
             <search index="3"><![CDATA[$url = '';]]></search>
             <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
        $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
    }]]></add>
          </operation>
          <operation>
             <search><![CDATA[$data['filter_order_id'] = $filter_order_id;]]></search>
             <add position="before"><![CDATA[$data['filter_name'] = $filter_name;]]></add>
          </operation>
       </file>
       <file path="admin/model/sale/order.php">
          <operation>
             <search index="0"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
             <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
                $sql .= " AND o.order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
            }]]></add>
          </operation>
          <operation>
             <search index="1"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
             <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
                $sql .= " AND order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
            }]]></add>
          </operation>
       </file>
    </modification>

     

     

    Капец, даже представить не смог что и за 2 пробела такое. Спасибо Том!
    П.С. Кому нужно берите, модификатор рабочий.

    • +1 1
  2. Здравствуйте. Помогите разобраться с модификатором. Пытаюсь адаптировать его с 2.3 на 3х. Само поле появилось в фильтре заказов но не фильтрует, обновляется страница и все. Делаю все на чистом OcStore где нету вообще ничего кроме то что с коробки.

    Спасибо.

     

    Скрытый текст
    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
       <name>Filter Name</name>
       <code>filter_wfm</code>
       <version>1.0</version>
       <author></author>
       <link />
       <file path="admin/view/template/sale/order_list.twig">
          <operation>
             <search index="0"><![CDATA[<div class="form-group">]]></search>
             <add position="before"><![CDATA[<div class="form-group">
                    <label class="control-label" for="input-filter-name">Наименование товара</label>
                    <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="Наименование товара" id="input-filter-name" class="form-control" />
                </div>]]></add>
          </operation>
          <operation>
             <search><![CDATA[var filter_order_id = $('input[name=\'filter_order_id\']').val();]]></search>
             <add position="after"><![CDATA[var filter_name = $('input[name=\'filter_name\']').val();
    if (filter_name) {
        url += '&filter_name=' + encodeURIComponent(filter_name);
    }]]></add>
          </operation>
       </file>
       <file path="admin/controller/sale/order.php">
          <operation>
             <search><![CDATA[protected function getList() {]]></search>
             <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
        $filter_name = $this->request->get['filter_name'];
    } else {
        $filter_name = null;
    }]]></add>
          </operation>
          <operation>
             <search><![CDATA['filter_order_id'      => $filter_order_id,]]></search>
             <add position="before"><![CDATA['filter_name'          => $filter_name,]]></add>
          </operation>
          <operation>
             <search index="3"><![CDATA[$url = '';]]></search>
             <add position="after"><![CDATA[if (isset($this->request->get['filter_name'])) {
        $url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
    }]]></add>
          </operation>
          <operation>
             <search><![CDATA[$data['filter_order_id'] = $filter_order_id;]]></search>
             <add position="before"><![CDATA[$data['filter_name'] = $filter_name;]]></add>
          </operation>
       </file>
       <file path="admin/model/sale/order.php">
          <operation>
             <search index="0"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
             <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
                $sql .= " AND o.order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
            }]]></add>
          </operation>
          <operation>
             <search index="1"><![CDATA[if (!empty($data['filter_order_id'])) {]]></search>
             <add position="before"><![CDATA[if (!empty($data['filter_name'])) {
                $sql .= " AND order_id IN (SELECT " . DB_PREFIX . "order_product.order_id FROM " . DB_PREFIX . "order_product WHERE " . DB_PREFIX . "order_product.name LIKE '%" . $this->db->escape($data['filter_name']) . "%')";
            }]]></add>
          </operation>
       </file>
    </modification>

     

     

  3. 27.02.2023 в 21:49, Desserro сказал:

    Я вас зрозумів де ви це знайшли

    Але ж поруч був і під 3-ку

    Тримайте:

     

     

      Показать содержимое
    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
       <name>Редактирование цены товара в заказе</name>
       <code>edit-product-price-in-order</code>
       <version>2.0</version>
       <author></author>
       <link></link>
     
       <file path="catalog/language/{ru-ru,russian}/api/cart.php">
          <operation>
             <search><![CDATA[$_['error_required']]]></search>
             <add position="after"><![CDATA[
             
             $_['error_numeric'] = 'Ошибка: цена должна быть числовым значением!';
             
             ]]></add>
          </operation>      
       </file>
       <file path="catalog/language/{en-gb,english}/api/cart.php">
          <operation>
             <search><![CDATA[$_['error_required']]]></search>
             <add position="after"><![CDATA[
             
             $_['error_numeric'] = 'Error: Price should be a numeric value!';
             
             ]]></add>
          </operation>      
       </file>
     
        <file path="system/{library,library/cart}/cart.php">
          <operation>
             <search><![CDATA[$recurring_query =]]></search>
             <add position="before"><![CDATA[
             
             $order_edit = $this->db->query("SELECT * FROM ".DB_PREFIX."order_cart WHERE product_id = '".(int)$product_query->row['product_id']."'");
     
                if ($order_edit->num_rows) {
                $price = $order_edit->row["price"];
             }
             
             ]]></add>
          </operation>
       </file>
                                 
       <file path="admin/model/sale/order.php">
          <operation>
             <search><![CDATA[ModelSaleOrder extends Model {]]></search>
                <add position="after"><![CDATA[
               
             public function checkOrderCartTable()
             {
                $this->db->query("CREATE TABLE IF NOT EXISTS `".DB_PREFIX."order_cart` (
                   `order_cart_id` int(11) NOT NULL AUTO_INCREMENT,
                   `product_id` int(11) NOT NULL,
                   `price` decimal(15,4) NOT NULL,
                   PRIMARY KEY(`order_cart_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8");
             }
                 
             public function deleteOrderCart()
             {
                $this->db->query("DELETE FROM ".DB_PREFIX."order_cart");
             }
                     
             ]]></add>
          </operation>
       </file>
                                   
       <file path="admin/controller/sale/order.php">
          <operation>
             <search><![CDATA[sale/order_form]]></search>
                <add position="before"><![CDATA[
               
                $this->model_sale_order->checkOrderCartTable();
                $this->model_sale_order->deleteOrderCart();
               
                $data['button_refresh'] = $this->language->get('button_refresh');
               
                $data['catalog'] = $this->request->server['HTTPS'] ? HTTPS_CATALOG : HTTP_CATALOG;
             
             if (!isset($data['api_token'])) {
                if (!isset($data['user_token']) && version_compare(VERSION, '3', '>=')) {
                   $data['user_token'] = $this->session->data['user_token'];
                } elseif (!isset($data['token'])) {
                   $data['token'] = $this->session->data['token'];
                }
             }
             
             ]]></add>
          </operation>
       </file>
     
       <file path="admin/view/template/sale/order_form.tpl">
          <operation>
             <search index="0"><![CDATA[<td class="text-right">' + product['price'] + '</td>]]></search>
             <add position="replace"><![CDATA[<td class="text-right"><div class="input-group" style="max-width: 200px;"><input type="text" id="product-price-' + product['product_id'] + '" value="' + product['original_price'] + '" class="form-control" /><span class="input-group-btn"><button type="button" id="button-refresh-price-' + product['product_id'] + '" data-toggle="tooltip" title="" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-success refresh-price" data-original-title="<?php echo $button_refresh; ?>"><i class="fa fa-refresh"></i></button></span></div></td>]]></add>
          </operation>
          <operation>
             <search><![CDATA[<?php echo $footer; ?>]]></search>
             <add position="before"><![CDATA[
             
             <script type="text/javascript">
             
             $('#content').delegate("button.refresh-price", "click", function()
             {
                   product_id = $(this).attr("id").replace("button-refresh-price-", "");
     
                <?php if (version_compare(VERSION, '2.1', '>=')) { ?>
                   cart_url = "<?php echo $catalog; ?>index.php?route=api/cart/updateprice";
                <?php } else { ?>
                   cart_url = "index.php?route=sale/order/api&api=api/cart/updateprice";
                <?php } ?>
             
                <?php if (isset($token)) { ?>
                   if (typeof token != 'undefined') cart_token = "&token=" + token;
                   else cart_token = "&token=<?php echo $token; ?>";
                <?php } ?>
               
                if ($("select[name='store_id']").length > 0) {
                   cart_store = $("select[name='store_id'] option:selected").val();
                } else {
                   cart_store = 0;
                }
             
                   $.ajax({
                   url: cart_url + '&store_id=' + cart_store + cart_token,              
                        type: "post",
                        data: {"product_id": product_id, "price": $("#product-price-" + product_id).val()},
                        dataType: "json",
                        beforeSend: function() {
                         $("#button-product-add").button("loading");
                   },
                   complete: function() {
                         $("#button-product-add").button("reset");
                   },
                   success: function(json) {
                         $(".alert, .text-danger").remove();
                         $(".form-group").removeClass("has-error");
     
                         if (json["error"]) {
                            $("#content > .container-fluid").prepend("<div class='alert alert-danger'><i class='fa fa-exclamation-circle'></i> " + json["error"] + " <button type='button' class='close' data-dismiss='alert'>&times;</button></div>");
                         } else {
                         $("#content > .container-fluid").prepend("<div class='alert alert-success'><i class='fa fa-check-circle'></i> " + json["success"] + " <button type='button' class='close' data-dismiss='alert'>&times;</button></div>");
                         
                         $("#button-refresh").trigger("click");
                      }
                   },
                        error: function(xhr, ajaxOptions, thrownError) {
                      alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                   }
                });
             });
                                 
             </script>
             
             <!--CART PLACEHOLDER-->
             
             ]]></add>
          </operation>      
       </file>
       
       <file path="admin/view/template/sale/order_form.twig">
          <operation>
             <search index="0"><![CDATA[<td class="text-right">' + product['price'] + '</td>]]></search>
             <add position="replace"><![CDATA[<td class="text-right"><div class="input-group" style="max-width: 200px;"><input type="text" id="product-price-' + product['product_id'] + '" value="' + product['original_price'] + '" class="form-control" /><span class="input-group-btn"><button type="button" id="button-refresh-price-' + product['product_id'] + '" data-toggle="tooltip" title="" data-loading-text="{{ text_loading }}" class="btn btn-success refresh-price" data-original-title="{{ button_refresh }}"><i class="fa fa-refresh"></i></button></span></div></td>]]></add>
          </operation>
          <operation>
             <search><![CDATA[{{ footer }}]]></search>
             <add position="before"><![CDATA[
             
             <script type="text/javascript">
             
             $('#content').delegate("button.refresh-price", "click", function()
             {
                   product_id = $(this).attr("id").replace("button-refresh-price-", "");
             
                cart_url = "{{ catalog }}index.php?route=api/cart/updateprice";
             
                {% if api_token %}
                   if (typeof api_token != 'undefined') cart_token = "&api_token=" + api_token;
                   else cart_token = "&api_token={{ api_token }}";
                {% elseif user_token %}
                   if (typeof user_token != 'undefined') cart_token = "&user_token=" + user_token;
                   else cart_token = "&user_token={{ user_token }}";
                {% endif %}
               
                if ($("select[name='store_id']").length > 0) {
                   cart_store = $("select[name='store_id'] option:selected").val();
                } else {
                   cart_store = 0;
                }
             
                   $.ajax({
                   url: cart_url + '&store_id=' + cart_store + cart_token,              
                        type: "post",
                        data: {"product_id": product_id, "price": $("#product-price-" + product_id).val()},
                        dataType: "json",
                        beforeSend: function() {
                         $("#button-product-add").button("loading");
                   },
                   complete: function() {
                         $("#button-product-add").button("reset");
                   },
                   success: function(json) {
                         $(".alert, .text-danger").remove();
                         $(".form-group").removeClass("has-error");
     
                         if (json["error"]) {
                            $("#content > .container-fluid").prepend("<div class='alert alert-danger'><i class='fa fa-exclamation-circle'></i> " + json["error"] + " <button type='button' class='close' data-dismiss='alert'>&times;</button></div>");
                         } else {
                         $("#content > .container-fluid").prepend("<div class='alert alert-success'><i class='fa fa-check-circle'></i> " + json["success"] + " <button type='button' class='close' data-dismiss='alert'>&times;</button></div>");
                         
                         $("#button-refresh").trigger("click");
                      }
                   },
                        error: function(xhr, ajaxOptions, thrownError) {
                      alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                   }
                });
             });
                                 
             </script>
             
             <!--CART PLACEHOLDER-->
             
             ]]></add>
          </operation>
       </file>
         
       <file path="catalog/controller/api/cart.php">
          <operation>
             <search><![CDATA[ControllerApiCart extends Controller {]]></search>
             <add position="after"><![CDATA[
             
             public function updatePrice()
             {
                $this->load->language('api/cart');
     
                $json = array();
     
                if (!isset($this->session->data['api_id'])) {
                   $json['error']['warning'] = $this->language->get('error_permission');
                } elseif (is_numeric($this->request->post['price'])) {
                   $this->db->query("DELETE FROM ".DB_PREFIX."order_cart WHERE product_id = '".$this->request->post['product_id']."'");
                   $this->db->query("INSERT INTO ".DB_PREFIX."order_cart SET product_id = '".$this->request->post['product_id']."', price = '".$this->request->post['price']."'");
                                 
                   $json['success'] = $this->language->get('text_success');
                } else {
                   $json['error'] = $this->language->get('error_numeric');
                }
               
                if (isset($this->request->server['HTTP_ORIGIN'])) {
                   $this->response->addHeader('Access-Control-Allow-Origin: '.$this->request->server['HTTP_ORIGIN']);
                   $this->response->addHeader('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
                   $this->response->addHeader('Access-Control-Max-Age: 1000');
                   $this->response->addHeader('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
                }
     
                $this->response->addHeader('Content-Type: application/json');
                $this->response->setOutput(json_encode($json));          
             }
               
             ]]></add>
          </operation>
          <operation>
             <search><![CDATA[$json['products'][] = array(]]></search>
             <add position="after"><![CDATA[    
             
             'original_price' => $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')),
             
             ]]></add>
          </operation>      
       </file>
    </modification>

     

    Изначально этот модификатор и поставил, но он очень плохо работает если у магазина несколько валют. По этому и принял решение адаптировать тот что знаю на практике что работает отлично. Спасибо

  4. 27.02.2023 в 22:09, Desserro сказал:

    Тільки зайве приберіть

    Те що для 2 версії

     

    А бо ви хотіли повчитись на цьому!? То вибачайте якщо що!

    Разобрался еще вчера. Все работает отлично изменив ссылку в данной строке:
     

    var override_url = '{{ catalog }}index.php?route=api/cart/price_override&api_token={{ api_token }}&store_id=' + $('select[name=\'store_id\'] option:selected').val();
    		locked = true;

     

  5. Здравствуйте. Еще одна попытка что либо адаптировать с 2.3 на 3х. Модификатор не большой, изменяет цену товара при редактирование заказа из админки. Модификатор почти допилил, реагирует на некоторые событья но вот сохранять итоговое значение не хочет. Глаз уже замылился и не могу найти причину, ткните пожалуйста)

     

    Скрытый текст
    <?xml version="1.0" encoding="UTF-8"?>
    <modification>
    	<name>Редактирование цены товара в заказе</name>
      	<code>edit-product-price-in-order</code>
      	<version>2.0</version>
      	<author></author>
      	<link></link>
    
    	<file path="admin/controller/sale/order.php">
    		<operation error="log">
    			<search><![CDATA[/order_form]]></search>
    			<add position="before"><![CDATA[
    		if (!isset($data['currency_code'])) {
    			$data['currency_code'] = isset($order_info['currency_code']) ? $order_info['currency_code'] : $this->config->get('config_currency');
    		}
    		$data['currency_decimal_place'] = $this->currency->getDecimalPlace($data['currency_code']);
    			]]></add>
    		</operation>
    	</file>
    
    	<file path="admin/view/template/sale/order_form.twig">
    		<operation error="log">
    			<search index="0"><![CDATA[<td class="text-right">{{ column_price }}</td>]]></search>
    			<add position="replace"><![CDATA[<td class="text-right"><span data-original-title="Click Price to Edit" data-toggle="tooltip" title="">{{ column_price }}</span></td>]]></add>
    		</operation>
    		<operation error="log">
    			<search index="0"><![CDATA[<td class="text-right">' + product['price'] + '</td>';]]></search>
    			<add position="replace"><![CDATA[<td class="text-right price-editable" data-decimal="' + product['decimal_symbol'] + '" data-product="' + i + '">' + product['price'] + '</td>';]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA[<td class="text-right" colspan="4">' + total['title'] + ':</td>']]></search>
    			<add position="replace"><![CDATA[' + (total['code'] == 'shipping' ? '<td class="text-right" colspan="4"><span data-original-title="Click Price to Edit" data-toggle="tooltip" title="">' + total['title'] + ':</span></td>' : '<td class="text-right" colspan="4">' + total['title'] + ':</td>')]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA[<td class="text-right">' + total['text'] + '</td>']]></search>
    			<add position="replace"><![CDATA[' + (total['code'] == 'shipping' ? '<td class="text-right price-editable" data-decimal="' + total['decimal_symbol'] + '" data-product="' + total['code'] + '">' + total['text'] + '</td>' : '<td class="text-right">' + total['text'] + '</td>')]]></add>
    		</operation>
    		<operation error="log">
    			<search index="0"><![CDATA[</script]]></search>
    			<add position="after"><![CDATA[
    <style>
    	html.wait, html.wait * {
    		cursor: wait !important;
    	}
    	.price-override {
    		width: 70px;
    		text-align: center;
    	}
    	table td.red {
    		background:rgba(255,180,170,.7)!important;
    	}
    	table td {
    		-webkit-transition: background-color 300ms linear;
    		-moz-transition: background-color 300ms linear;
    		-o-transition: background-color 300ms linear;
    		-ms-transition: background-color 300ms linear;
    		transition: background-color 300ms linear;
    	}
    	.table td span[data-toggle="tooltip"]::after {
    	    font-family: FontAwesome;
    	    color: #1E91CF;
    	    content: "\f059";
    	    margin-left: 4px;
    	}
    </style>
    <style id="temp-style">
    </style>
    <script type="text/javascript">
    
    var productPrices = {};
    var locked = false;
    var keyCode;
    
    // Price Override
    $('#content').on('click', '.price-editable', function() {
    
    	// Restore Siblings
    	$('.price-override').each(function(k,v) {
    		var parent = $(this).parent();
    		var rowPrice = productPrices[parent.data('product')];
    		parent.addClass('price-editable').html(rowPrice);
    	});
    	
    	$(this).removeClass('price-editable');
    	var row = $(this).data('product');
    	productPrices[row] = $(this).text();
    	var decimal_symbol = $(this).data('decimal');
    	var regex = new RegExp('[^0-9\\' + decimal_symbol + '-]+', 'g');
    	var price = Number(productPrices[row].replace(regex,"").replace(decimal_symbol,'.')).toFixed({{ currency_decimal_place }});
    	$(this).html('<input type="text" class="price-override" value="' + price + '" />');
    	$(this).find('input').focus().select();
    });
    
    $('#content').on('input', '.price-override', function() {
    	this.value = this.value.replace(/[^0-9.-]/g, '').replace(/(\..*)\./g, '$1');
    }).on('keypress', '.price-override', function(e) {
    	if (e.keyCode == 13 || e.keyCode == 27) {
    		keyCode = e.keyCode;
    		$(this).blur();
    	}
    }).on('blur', '.price-override', function() {
    	var self = this;
    	var parent = $(this).parent();
    	var rowPrice = productPrices[parent.data('product')];
    
    	if ($(this).closest('tr').find('.btn-danger').length) {
    		var key = $(this).closest('tr').find('.btn-danger').val();
    	} else {
    		var key = parent.data('product');
    	}
    
    	parent.removeClass('red');
    	$('#temp-style').html('');
    
    if (keyCode != 27 && +rowPrice != +this.value && !locked) {
    			var override_url = '{{ catalog }}index.php?route=api/cart/add&api_token={{ api_token }}&store_id=' + $('select[name=\'store_id\'] option:selected').val();
    		locked = true;
    		$("html").addClass("wait");
    		$.ajax({
    			url: override_url,
    			type: 'post',
    			data: 'price=' + self.value + '&key=' + encodeURIComponent(key),
    			dataType: 'json',
    			crossDomain: true,
    			complete: function() {
    				$("html").removeClass("wait");
    				locked = false;
    			},		
    			success: function(json) {
    				if (json === false) {
    					parent.addClass('red price-editable').html(rowPrice);
    					setTimeout(function() { parent.removeClass('red'); }, 1000);
    				} else {
    					$('#button-refresh').click();
    					parent.addClass('price-editable').html(json);
    					$('#temp-style').html(	"td[data-product='" + parent.data('product') + "'] { background: rgba(130,255,130,.7)!important; }" );
    					setTimeout(function() { $('#temp-style').html(''); }, 1000);
    				}
    			},	
    			error: function(xhr, ajaxOptions, thrownError) {
    				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
    			}
    		});
    	} else {
    		parent.addClass('price-editable').html(rowPrice);
    	}
    });
    </script>
    			]]></add>
    		</operation>
    	</file>
    
    	<file path="catalog/model/total/shipping.php,catalog/model/extension/total/shipping.php">
    		<operation error="log">
    			<search><![CDATA[[] = array(]]></search>
    			<add position="before"><![CDATA[
    			if (isset($this->session->data['price_override']['shipping'])) {
    				$this->session->data['shipping_method']['cost'] = $this->session->data['price_override']['shipping'];
    			}
    			]]></add>
    		</operation>
    	</file>
    
    	<file path="catalog/controller/api/cart.php">
    		<operation error="log">
    			<search><![CDATA[extends Controller {]]></search>
    			<add position="after"><![CDATA[
    	public function price_override() {
    		if (array_diff(array('key','price'),array_keys($this->request->post))) {
    			$json = false;
    		} else {
    			$json = $this->currency->format($this->request->post['price'],$this->session->data['currency'],1);
    			$calc = $this->currency->format($this->request->post['price'],$this->session->data['currency'],1,false);
    			if ($this->request->post['key'] != 'shipping') {
    				$cart = $this->cart->getProduct($this->request->post['key']);
    				if (!empty($cart)) {
    					$key['product_id'] = $cart['product_id'];
    					$key['option'] = json_decode($cart['option']);
    					$key = base64_encode(serialize($key));
    				} else {
    					$json = false;
    				}
    			} else {
    				$key = $this->request->post['key'];
    				$products = $this->cart->getProducts();
    				if (isset($products[$key])) $cart = $products[$key];
    			}
    			if (isset($key)) {
    				if ($this->config->get('config_tax') && !empty($cart)) {
    					$tax_class_id = $this->cart->getProductTaxClassId($cart['product_id']);
    					if ($tax_class_id) {
    						$tax_rates = array_reverse($this->tax->getRates($calc,$tax_class_id));
    						if ($tax_rates) {
    							foreach ($tax_rates as $tax_rate) {
    								if ($tax_rate['type'] == 'F') {
    									$calc -= $tax_rate['rate'];
    								} elseif ($tax_rate['type'] == 'P') {
    									$calc /= ($tax_rate['rate'] + 100) / 100;
    								}
    							}
    							$this->request->post['price'] = $calc;
    							$json = $this->currency->format($this->request->post['price'],$this->session->data['currency'],1);
    						}
    					}
    				}
    				$this->session->data['price_override'][$key] = $this->currency->convert($this->request->post['price'],$this->session->data['currency'],$this->config->get('config_currency'));
    			}
    		}
    		$this->response->addHeader('Content-Type: application/json');
    		$this->response->setOutput(json_encode($json));
    	}
    			]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA[$json['products'][] = array(]]></search>
    			<add position="after"><![CDATA[
    					'decimal_symbol'	=> $this->language->get('decimal_point'),
    			]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA['title' => $total['title'],]]></search>
    			<add position="before"><![CDATA[
    					'code' 				=> $total['code'],
    					'decimal_symbol'	=> $this->language->get('decimal_point'),
    			]]></add>
    		</operation>
    	</file>
    
    	<file path="system/library/cart.php">
    		<operation error="log">
    			<search><![CDATA[// Stock]]></search>
    			<add position="before"><![CDATA[
    						$key_parts = array(
    							'product_id'	=> $cart['product_id'],
    							'option'		=> json_decode($cart['option'])
    						);
    						$key = base64_encode(serialize($key_parts));
    					if (isset($this->session->data['price_override'][$key])) {
    						$price = $this->session->data['price_override'][$key];
    						$option_price = 0;
    					}
    			]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA[class Cart {]]></search>
    			<add position="after"><![CDATA[
    	public function getProduct($cart_id) {
    		return $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE cart_id = '" . (int)$cart_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'")->row;
    	}
    	public function getProductTaxClassId($product_id) {
    		$row = $this->db->query("SELECT tax_class_id FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'")->row;
    		return $row ? $row['tax_class_id'] : false;
    	}
    			]]></add>
    		</operation>
    	</file>
    	<file path="system/library/cart/cart.php">
    		<operation error="log">
    			<search><![CDATA[$product_data[] = array(]]></search>
    			<add position="before"><![CDATA[
    					$key_parts = array(
    						'product_id'	=> $cart['product_id'],
    						'option'		=> json_decode($cart['option'])
    					);
    					$key = base64_encode(serialize($key_parts));
    					if (isset($this->session->data['price_override'][$key])) {
    						$price = $this->session->data['price_override'][$key];
    						$option_price = 0;
    						$allprice = $price + $option_price;
    					}
    			]]></add>
    		</operation>
    		<operation error="log">
    			<search><![CDATA[class Cart {]]></search>
    			<add position="after"><![CDATA[
    	public function getProduct($cart_id) {
    		return $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE cart_id = '" . (int)$cart_id . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'")->row;
    	}
    	public function getProductTaxClassId($product_id) {
    		$row = $this->db->query("SELECT tax_class_id FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'")->row;
    		return $row ? $row['tax_class_id'] : false;
    	}
    			]]></add>
    		</operation>
    	</file>
    </modification>

     

     

  6. Здравствуйте. Решил я тут в первый раз попробовать адаптировать модуль для версии 3х. В целом получилось, модуль работает. В модификаторе наткнулся на один момент который никак не могу понять как решить. Подскажите кто знает. 

    Кусок кода, проблема у меня в первой линии, никак не могу догнать как преобразовать под синтаксис Twig

     

     <?php if (isset($files) and is_array($files))foreach($files as $f)
              { ?>
              <div class='col-sm-12' style='padding:10px;'>
                <div class='input-group'>
                   <div class="file"><a class="remove btn btn-danger" id="del<?php echo $f['orderfile_id'];?>" style="margin-right:10px" onclick="remove(<?php echo $f['orderfile_id'];?>);return false;">Удалить</a><?php echo $f['filename'];?></div>
                </div>
              </div>
    <?php }?>

    На всякий случай, прикрепил весь модификатор.

    За ранее спасибо всем.

    install.xml

  7. Здравствуйте уважаемые программисты и гуру Opencart 3. Сразу к делу. Нужно написать модуль для магазина модульной мебели. 

    1. Вывод модуля на главной страницы с товарами без цен. Две кнопки "Консультация - поп-ап с формой, имя фамилия + телефон + сообщение" + "Калькулятор цен - переход в карточку товара"

    2. Возможность при добавления товара, добавить любое количества модулей к данной позиции. Со следующими параметрами: цена + количество (так же клиент может из фронта выбрать скок шт. того или иного модуля ему необходимо) + размер + фото (что-то на подобие опции - не как отдельные позиции товара).

    3. Было бы шикарно все мебельные модули добавить в настройках модуля, далее только вызвать в карточке товара. Так же группировка + сортировка модулей (К примеру создавать категории для модулей).

    4. Конечно же адаптация под любое устройство (делать все буду на дефолтном шаблоне)

    Отвечу на все вопросы. Позже прикреплю примерный эскиз того как я это вижу визуально во фронте.

    Спасибо.

  8. 6 минут назад, PaulKravchenko сказал:
    
          {% if currency.symbol_left and currency.code == code %} <strong>{{ currency.symbol_left }}</strong> {% elseif currency.symbol_right and currency.code == code %} <strong>{{ currency.symbol_right }}</strong> {% endif %}
          {% if currency.code == code %} <span class="hidden-xs hidden-sm hidden-md">{{ currency.code }}</span> {% endif %}{% endfor %}&nbsp;<i class="fa fa-caret-down"></i></button>

     

    Спасибо Вам огромное!! оказалась все на много проще чем я себе представлял и главное что работает )

  9. Здравствуйте, подскажите пожалуйста. Обновил шаблон до 1.7 и у меня сломалось отображение опции во фронте.

    На сколько я знаю, если нет картинки он ставит значение опции. Как лечить ?

    9a6a522255.png

  10. Здравствуйте, помогите понять как осуществить.

    Имеем в currency.twig:

    {% if currencies|length > 1 %}
    <div id="currency" class="curency fm_mobile_menu_info-item">
      <div class="fm_mobile_menu_info-title d-lg-none">{{ text_currency }}</div>
      <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-currency" class="h-100">
        <div class="btn-group h-100">
          <button class="btn btn-currency btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% for currency in currencies %}
          {% if currency.symbol_left and currency.code == code %} {{ currency.symbol_left }} {% elseif currency.symbol_right and currency.code == code %} {{ currency.symbol_right }} {% endif %}
          {% endfor %} <span>{{ text_currency }}</span><i class="fas fa-chevron-down"></i></button>
          <div class="dropdown-menu dropdown-menu-right nav-dropdown-menu">
            {% for currency in currencies %}
            {% if currency.symbol_left %}
              <button class="currency-select btn btn-block{% if currency.code == code %} active-item{% endif %}" type="button" name="{{ currency.code }}">{{ currency.symbol_left }} {{ currency.title }}</button>
            {% else %}
              <button class="currency-select btn btn-block{% if currency.code == code %} active-item{% endif %}" type="button" name="{{ currency.code }}">{{ currency.symbol_right }} {{ currency.title }}</button>
            {% endif %}
            {% endfor %}
          </div>
        </div>
        <input type="hidden" name="code" value="" />
        <input type="hidden" name="redirect" value="{{ redirect }}" />
      </form>
    </div>
    {% endif %} 

    Что хочу изменить:

    вместо <span>{{ text_currency }}</span> что бы было <span>{{ currency.code }}</span> а в самом выпадающем списке осталось как есть, то есть, {{ currency.symbol_left }} {{ currency.title }}.

    Пробовал ставить элементарно вместе {{ text_currency }} - {{ currency.code }} но в таком случай в шапке остается только символ валюты. Подскажите куда копать пожалуйста. 

    Всем спасибо

  11. 4 minutes ago, Leingard said:

     

    Модуль позволяет видеть в тулбаре сверху каких товаров осталось в наличии менее 10 штук

     

    Спасибо. Не плохо, но все же не то. Хотелось что бы отправилось менеджеру по закупкам на почту список товаров которые скоро закончится

  12. Всем привет. Не уверен что есть такой модуль но все может кто-то знает. Нужен модуль который бы оповестил меня по почте что вот "этот список" товаров осталось к примеру 5 шт., нужно заказать. Встречал ли кто-то такое ?

  13. Здравствуйте. В поисках модуля с таким функционалом. Не уверен что существует )

    - Промокоды (действует на любую сумму покупки, но при этом другие скидки не действуют на неё) - не знаю если купоны опенкарта на это способны

    - Скидка 200 рублей на любой "матрас" при покупки "кровати"

    - Скидка 200 рублей на "стул" при покупке "кровати" и "матраса"

    Может кто встречал такой модуль. Буду весьма благодарен

     

  14. Здравствуйте, пытаюсь сделать модификатор что бы добавил фото товара в письмо заказа. Ячейка создалась но фото никак не появится. 

    Может вы заметите в чем моя ошибка, я уже устал ))

    Opencart 3.0.2.0

    <modification>
    	<name>Add product image in mail</name>
    	<id>Add product image in mail</id>
    	<code>add_product_image_in_mail</code>
    	<version>1.0</version>
    	<author>EchoElse</author>
    	<link>https://kwork.ru/user/echoelse</link>
    	<file path="catalog/model/checkout/order.php">
    		<operation>
    			<search><![CDATA[
    			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");
    			]]></search>
    			<add position="replace"><![CDATA[
    				  $query = $this->db->query("SELECT op.*, pi.image FROM " . DB_PREFIX . "order_product op, " . DB_PREFIX . "product pi WHERE op.order_id = '" . (int)$order_id . "' AND op.product_id = pi.product_id");
    				  ]]>
    			</add>
    		</operation>
    		</file>
    	<file path="catalog/model/checkout/order.php">
    		<operation>
    			<search><![CDATA[
    			$data['products'][] = array(
    			]]></search>
    			<add position="after"><![CDATA[
    				  'product_image' => HTTPS_SERVER.'image/'.$order_product['image'],
    				  ]]>
    			</add>
    		</operation>
    	</file>
    	<file path="catalog/view/theme/default/template/mail/order_add.twig">
    		<operation>
    			<search index="6"><![CDATA[
    			<tr>
    			]]></search>
    			<add position="after"><![CDATA[
    				<td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">Изображение</td>
    				  ]]>
    			</add>
    		</operation>
    		<operation>
    			<search index="7"><![CDATA[
    			<tr>
    			]]></search>
    			<add position="after"><![CDATA[
    				 <td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;"><img src="{{ product.product_image }}" alt="" style="width: 40px; border: none;"></td>
    				  ]]>
    			</add>
    		</operation>
    		<operation>
    			<search><![CDATA[
    			<td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="4"><b>{{ total.title }}:</b></td>
    			]]></search>
    			<add position="replace"><![CDATA[
    				 <td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;" colspan="5"><b>{{ total.title }}:</b></td>
    				  ]]>
    			</add>
    		</operation>		
    	</file>
    
    </modification>

     

  15. Здравствуйте. 

    Пытаюсь создать модификатор, для личных целей. На данный момент он просто убивает любой купон который вводишь на страницу оформление заказа, но я пытаюсь сделать что бы он все же выставил имя купона = 0

     

    <?xml version="1.0" encoding="utf-8"?>
    <modification>
        <name>Отмена купонов на акционный товар</name>
        <code>no_coup_app_if_p_spec</code>
        <version>1.0</version>
        <author>kupo</author>
        <link>kupon</link>
        <file path="catalog/model/total/coupon.php">        
          <operation>
                <search><![CDATA[
                    if ($coupon_info) {
                ]]></search>
                <add position="after" index="1"><![CDATA[
                    $this->load->model('catalog/product');
                ]]></add>
            </operation>
            <operation>
                <search><![CDATA[
                    $discount = 0; - вот тут он убивает купон (крутится прелоадер и все)
                ]]></search>
                <add position="before" index="1"><![CDATA[
                    // Don't discount if product is on special
                $results = $this->model_catalog_product->getProduct($product['product_id']);
                if ($results['special']) {
                    continue;
                }
                ]]></add>
            </operation>
        </file>
    </modification>

    тыкните пожалуйста что дописать =)

    Всем спасибо.

  16. 22 hours ago, bravo300 said:

    В логах есть вот такая запись

    2019-11-26 15:28:59 - PHP Notice:  Undefined index: customer_group_id in /home/xnsdsds123/public_html/system/storage/modification/catalog/controller/api/order.php on line 946

    но мне кажется это не из той оперы

    Если хотите могу посмотреть

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.