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

Вывод атрибутов товаров в письме администратору


Recommended Posts

Версия ocStore 2.3.0.2.3

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

Есть такой ocmod с добавлением картинок к письму - он прекрасно работает

<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>image_to_email</name>
<code>image_to_email</code>
<version>2.0.3.2</version>
<date>23.08.2016</date>
<author>ArkaDos ajsman@gmail.com</author>
<file path="catalog/model/checkout/order.php">
    <operation>
        <search><![CDATA[ $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'"); ]]></search>
        <add position="after"><![CDATA[
            $p_image = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product['product_id'] . "'");
            $product_image = !empty($p_image->row['image']) ? HTTP_SERVER . 'image/' . $p_image->row['image'] : ''; // картинка товара
        ]]></add>
    </operation>
    <operation>
        <search><![CDATA[ $data['products'][] = array( ]]></search>
        <add position="after"><![CDATA[
            'image'    => $product_image,
        ]]></add>
    </operation>
</file>
<file path="catalog/view/theme/*/template/mail/order.tpl">
    <operation>
        <search><![CDATA[ <?php foreach ($product['option'] as $option) { ?> ]]></search>
        <add position="before"><![CDATA[
            <?php if( isset($product['image']) && !empty($product['image']) ){ ?>
                    <img src="<?php echo $product['image']; ?>" width="160px" height="160px">
            <?php } ?>
        ]]></add>
    </operation>
</file>
</modification>

Есть такой xml с добавлением аттрибутов, но для версии 1.5

<modification>
        <id>Attribute to Email</id>
        <version>1.0</version>
        <vqmver>1.0.0</vqmver>
        <author>Dmitriy Kraev</author>
        <file name="catalog/model/checkout/order.php">
				<operation>
						<search position="before"><![CDATA[$template->data['products'][] = array(]]></search>
                        <add><![CDATA[
							$attr_data = array();
							$attribute = $this->db->query("SELECT a.text, b.name FROM " . DB_PREFIX . "product_attribute AS a, " . DB_PREFIX . "attribute_description AS b WHERE a.attribute_id = b.attribute_id AND a.language_id='2' AND  a.product_id = '" . $product['product_id'] . "'");
							
							foreach ($attribute->rows as $attr) {
								$attr_data[] = array(
									'name'  => $attr['name'],
									'text' => $attr['text']
								);					
							}
						]]></add>
				</operation>
				<operation>
						<search position="after"><![CDATA[$template->data['products'][] = array(]]></search>
                        <add><![CDATA[
							'attr'    => $attr_data,
						]]></add>
				</operation>
        </file>
        <file name="catalog/view/theme/*/template/mail/order.tpl">
				<operation>
						<search position="after"><![CDATA[<?php echo $product['name']; ?>]]></search>
                        <add><![CDATA[
						  <?php foreach ($product['attr'] as $attr) { ?>
						  <br />
						  &nbsp;<small> - <?php echo $attr['name']; ?>: <?php echo $attr['text']; ?></small>
						  <?php } ?>
						  <br />
						  <br />
						]]></add>
				</operation>
        </file>
</modification>

Пытался переделать под версию 2.3, но что-то не работает отправка. Подскажите, что и как подправить.

Link to post
Share on other sites

Кто поможет? Цена вопроса?

Link to post
Share on other sites

  • 2 years later...
  • 1 month later...
В 19.09.2020 в 18:59, zextro сказал:

Если кому-то понадобится - есть решение. 

Поделитесь решением. Или озвучьте цену.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.