N
N
nikitoshq2020-01-04 18:00:23
opencart
nikitoshq, 2020-01-04 18:00:23

How to add your code in the Simple module in Opencart?

It turns out that in the function that is executed after clicking the "Confirm Order" button, I need to add this code:

foreach ($data['products'] as $product) {
          $viberText  = "";
          $bitrix24products = "";
          $prodId = $product['product_id'];
          $order_mpn = $this->db->query("SELECT `mpn` FROM `" . DB_PREFIX . "product` WHERE `product_id` =  '$prodId'");
          $order_mpn  = $order_mpn->row["mpn"];
          $bitrix24option = empty($product['option']) ? "" : "<br/><br/><b>Опции:</b>";
          $viberTextOption = empty($product['option']) ? "" : "Опции: \n";
          $bitrix24products .= 
          "<b>Название:</b> ".$product['name']." (<a target='_blank' href='http://".$_SERVER['HTTP_HOST']."/index.php?route=product/product&product_id=".$product['product_id']."'>Ссылка</a>)".
          "<br/><b>Количество:</b> ".$product['quantity']." шт.".
          "<br/><b>Цена:</b> ".$product['price']." грн.".
          "<br/><b>Сумма:</b> ".$product['total']." грн.".
          "<br/><b>Поставщик:</b> ".$order_mpn.
          $bitrix24option;
          
          $viberText .="\nНазвание:\n".$product['name'].
          "\nКоличество:".$product['quantity']." шт.".
          "\nЦена: ".$product['price']." грн.".
          "\nСумма: ".$product['total']." грн.".$viberTextOption;
          
          foreach ($product['option'] as $option) {
            if ($option['type'] == 'checkbox') {
              $bitrix24products .= "<br/>-- Выбрано: ".$option['name'];
              $viberText .= "\nВыбрано: ".$option['name'];
            } else {
              $bitrix24products .= "<br/>-- ".$option['name'].": ".$option['value'];
              $viberText .= "\n".$option['name'].": ".$option['value'];
            }
          }

          if ($product != end($data['products'])) {
            $bitrix24products .= "<br/><br/>------------------------------------------------<br/><br/>";
            $viberText .= "\n";
          } else {
            $bitrix24products .= "<br/>";
            $viberText .= "\n";
          }
          $stack[$order_mpn] .= $viberText;
          $stackBitrix[$order_mpn] .= $bitrix24products;
                }

Can anyone familiar with this module, tell me where you can find this function?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita HQ, 2020-01-10
@nikitoshq

Own module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question