Jump to content

Recommended Posts

Здравствуйте! Подскажите пожалуйста, можно ли как-то скрыть поле купон для не зарегистрированных пользователей при оформлении заказа? стоит симпл.

Share this post


Link to post
Share on other sites

сделайте проверку в extension/total/coupon.php

типа if (!$this->customer->isLogged()) $status = false;

Share this post


Link to post
Share on other sites

Можно так:

simple-colapse-coupon-voucher.ocmod.xml

блок откирвается по клик.

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <name>Simple Colapse coupon voucher inputs</name>
    <code>colapse-couponcheckout</code>
    <version>1.0</version>
    <author>agatha65.com</author>
    
    <file path="catalog/language/ru-ru/checkout/simplecheckout.php">
        <operation>
            <search><![CDATA[$_['text_please_confirm']]]></search>
            <add position="after"><![CDATA[
            $_['text_next_choice2']         = 'У вас есть код купона на скидку или бонусные баллы';
            ]]></add>
        </operation>
    </file>
    <file path="catalog/language/en-gb/checkout/simplecheckout.php">
        <operation>
            <search><![CDATA[$_['text_please_confirm']]]></search>
            <add position="after"><![CDATA[
            $_['text_next_choice2']         = 'I have a coupon or gift card';
            ]]></add>
        </operation>
    </file>
    <file path="catalog/controller/checkout/simplecheckout_cart.php">
        <operation>
            <search><![CDATA[$this->_templateData['text_cart']            = $this->language->get('text_cart');]]></search>
            <add position="after"><![CDATA[
            $this->_templateData['text_next_choice2']            = $this->language->get('text_next_choice2');
            ]]></add>
        </operation>
    </file>
    <file path="catalog/view/theme/*/template/checkout/simplecheckout_cart.tpl">
        <operation>
            <search><![CDATA[
            <?php if (isset($modules['coupon'])) { ?>
            ]]></search>
            <add position="before"><![CDATA[
            <button class="btn colapse-coupon" type="button" data-toggle="collapse" data-target="#collapseCoupon" aria-expanded="false" aria-controls="collapseCoupon">
              <?php echo $text_next_choice2; ?>
            </button>
            <div class="collapse" id="collapseCoupon">
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[
            <input type="hidden" name="remove" value="" id="simplecheckout_remove">
            ]]></search>
            <add position="before"><![CDATA[
            </div>
            ]]></add>
        </operation>
    </file>
</modification>

 

Share this post


Link to post
Share on other sites
В 19.06.2019 в 23:37, spectre сказал:

сделайте проверку в extension/total/coupon.php

типа if (!$this->customer->isLogged()) $status = false;

Если возможно поподробней, куда это нужно в ставить в коде... 

 

<?php
class ControllerExtensionTotalCoupon extends Controller {
    public function index() {
        if ($this->config->get('coupon_status')) {
            $this->load->language('extension/total/coupon');

            $data['heading_title'] = $this->language->get('heading_title');

            $data['text_loading'] = $this->language->get('text_loading');

            $data['entry_coupon'] = $this->language->get('entry_coupon');

            $data['button_coupon'] = $this->language->get('button_coupon');

            if (isset($this->session->data['coupon'])) {
                $data['coupon'] = $this->session->data['coupon'];
            } else {
                $data['coupon'] = '';
            }

            return $this->load->view('extension/total/coupon', $data);
        }
    }

    public function coupon() {
        $this->load->language('extension/total/coupon');

        $json = array();

        $this->load->model('extension/total/coupon');

        if (isset($this->request->post['coupon'])) {
            $coupon = $this->request->post['coupon'];
        } else {
            $coupon = '';
        }

        $coupon_info = $this->model_extension_total_coupon->getCoupon($coupon);

        if (empty($this->request->post['coupon'])) {
            $json['error'] = $this->language->get('error_empty');

            unset($this->session->data['coupon']);
        } elseif ($coupon_info) {
            $this->session->data['coupon'] = $this->request->post['coupon'];

            $this->session->data['success'] = $this->language->get('text_success');

            $json['redirect'] = $this->url->link('checkout/cart');
        } else {
            $json['error'] = $this->language->get('error_coupon');
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }
}
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.