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

Потрібна знижка на товари певного виробника.


Recommended Posts

Доброго дня.
Шаблон Deals. 
Потрібно, щоб при оформленні, при досягненні певної суми, на товари певного виробника застосовувалась знижка. З'являлось повідомлення (Ваша знижка на товари ТМ ххх 123 грн.)
Спробував допомогу ЧатЖПТ... така дурня.
Ось, що вийшло з Microsoft Copilot:
 

Прихований текст
<modification>
    <name>Знижка на товари виробника ID 99</name>
    <code>discount_manufacturer_99</code>
    <version>1.3</version>
    <author>Ти 😉</author>
    <link>https://yourstore.com</link>
	
    <!-- discount_manufacturer-ПОЧАТОК -->
    <!-- Операція для першого місця -->
    <file path="catalog/controller/checkout/oct_smartcheckout.php">
        <operation>
            <search><![CDATA[$data['products'] = [];]]></search>
            <add position="after">
                <![CDATA[
                $discount_total = 0;
                $cart_total = $this->cart->getTotal();
                foreach ($products as &$product) {
                    if ($product['manufacturer_id'] == 99) {
                        $old_price = $product['price'];
                        if ($cart_total >= 15000) {
                            $product['price'] *= 0.95;
                        }
                        if ($cart_total >= 25000) {
                            $product['price'] *= 0.90;
                        }
                        $product['old_price'] = $old_price;
                        $discount_total += ($old_price - $product['price']) * $product['quantity'];
                    }
                }
                if ($discount_total > 0) {
                    $discount_amount = $this->currency->format($discount_total, $this->session->data['currency']);
                    $data['discount_message'] = sprintf($this->language->get('text_discount_message'), $discount_amount);
                }
                ]]>
            </add>
        </operation>
    </file>

    <!-- Операція для другого місця -->
    <file path="catalog/controller/checkout/oct_smartcheckout.php">
        <operation>
            <search><![CDATA[$data['products'] = [];]]></search>
            <search-offset>1</search-offset>
            <add position="after">
                <![CDATA[
                $discount_total = 0;
                $cart_total = $this->cart->getTotal();
                foreach ($products as &$product) {
                    if ($product['manufacturer_id'] == 99) {
                        $old_price = $product['price'];
                        if ($cart_total >= 15000) {
                            $product['price'] *= 0.95;
                        }
                        if ($cart_total >= 25000) {
                            $product['price'] *= 0.90;
                        }
                        $product['old_price'] = $old_price;
                        $discount_total += ($old_price - $product['price']) * $product['quantity'];
                    }
                }
                if ($discount_total > 0) {
                    $discount_amount = $this->currency->format($discount_total, $this->session->data['currency']);
                    $data['discount_message'] = sprintf($this->language->get('text_discount_message'), $discount_amount);
                }
                ]]>
            </add>
        </operation>
    </file>

    <!-- Додано мовні файли -->
    <file path="catalog/language/uk-ua/octemplates/module/oct_smartcheckout.php">
        <operation>
            <add position="end">
                <![CDATA[
                $_['text_discount_message'] = 'Ваша знижка %s на товари ТМ 100!';
                ]]>
            </add>
        </operation>
    </file>
    <file path="catalog/language/ru-ru/octemplates/module/oct_smartcheckout.php">
        <operation>
            <add position="end">
                <![CDATA[
                $_['text_discount_message'] = 'Ваша скидка %s на товары ТМ 100!';
                ]]>
            </add>
        </operation>
    </file>
	<!-- discount_manufacturer-КІНЕЦЬ -->
</modification>

 

Це для розуміння логіки, як має бути.
Але воно не працює :(
Потрібен працюючий варіант.
 

Надіслати
Поділитися на інших сайтах


В 17.03.2025 в 09:52, yurabr сказав:

Доброго дня.
Шаблон Deals. 
Потрібно, щоб при оформленні, при досягненні певної суми, на товари певного виробника застосовувалась знижка. З'являлось повідомлення (Ваша знижка на товари ТМ ххх 123 грн.)
Спробував допомогу ЧатЖПТ... така дурня.
Ось, що вийшло з Microsoft Copilot:
 

  Показати вміст
<modification>
    <name>Знижка на товари виробника ID 99</name>
    <code>discount_manufacturer_99</code>
    <version>1.3</version>
    <author>Ти 😉</author>
    <link>https://yourstore.com</link>
	
    <!-- discount_manufacturer-ПОЧАТОК -->
    <!-- Операція для першого місця -->
    <file path="catalog/controller/checkout/oct_smartcheckout.php">
        <operation>
            <search><![CDATA[$data['products'] = [];]]></search>
            <add position="after">
                <![CDATA[
                $discount_total = 0;
                $cart_total = $this->cart->getTotal();
                foreach ($products as &$product) {
                    if ($product['manufacturer_id'] == 99) {
                        $old_price = $product['price'];
                        if ($cart_total >= 15000) {
                            $product['price'] *= 0.95;
                        }
                        if ($cart_total >= 25000) {
                            $product['price'] *= 0.90;
                        }
                        $product['old_price'] = $old_price;
                        $discount_total += ($old_price - $product['price']) * $product['quantity'];
                    }
                }
                if ($discount_total > 0) {
                    $discount_amount = $this->currency->format($discount_total, $this->session->data['currency']);
                    $data['discount_message'] = sprintf($this->language->get('text_discount_message'), $discount_amount);
                }
                ]]>
            </add>
        </operation>
    </file>

    <!-- Операція для другого місця -->
    <file path="catalog/controller/checkout/oct_smartcheckout.php">
        <operation>
            <search><![CDATA[$data['products'] = [];]]></search>
            <search-offset>1</search-offset>
            <add position="after">
                <![CDATA[
                $discount_total = 0;
                $cart_total = $this->cart->getTotal();
                foreach ($products as &$product) {
                    if ($product['manufacturer_id'] == 99) {
                        $old_price = $product['price'];
                        if ($cart_total >= 15000) {
                            $product['price'] *= 0.95;
                        }
                        if ($cart_total >= 25000) {
                            $product['price'] *= 0.90;
                        }
                        $product['old_price'] = $old_price;
                        $discount_total += ($old_price - $product['price']) * $product['quantity'];
                    }
                }
                if ($discount_total > 0) {
                    $discount_amount = $this->currency->format($discount_total, $this->session->data['currency']);
                    $data['discount_message'] = sprintf($this->language->get('text_discount_message'), $discount_amount);
                }
                ]]>
            </add>
        </operation>
    </file>

    <!-- Додано мовні файли -->
    <file path="catalog/language/uk-ua/octemplates/module/oct_smartcheckout.php">
        <operation>
            <add position="end">
                <![CDATA[
                $_['text_discount_message'] = 'Ваша знижка %s на товари ТМ 100!';
                ]]>
            </add>
        </operation>
    </file>
    <file path="catalog/language/ru-ru/octemplates/module/oct_smartcheckout.php">
        <operation>
            <add position="end">
                <![CDATA[
                $_['text_discount_message'] = 'Ваша скидка %s на товары ТМ 100!';
                ]]>
            </add>
        </operation>
    </file>
	<!-- discount_manufacturer-КІНЕЦЬ -->
</modification>

 

Це для розуміння логіки, як має бути.
Але воно не працює :(
Потрібен працюючий варіант.
 

Доброго вечора, можу під вашу задачу написати індивідуальний модуль з адмінкою. Пишіть в особисті повідомлення обговоримо.

Надіслати
Поділитися на інших сайтах

Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

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