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

Условие для отдельной страницы


Recommended Posts

Подскажите, пожалуйста, как прописать условие для страницы контактов на опенкарт?
Так я прописывала для главной
<?php if ($_SERVER['REQUEST_URI']=="/" || $_SERVER['REQUEST_URI']=="/index.php?route=common/home") { ?>

текст

<?php } ?>

 

Нужно чтоб условие работало для главной страницы и страницы контактов

Edited by Julia1991radionova
Link to comment
Share on other sites


  • 1 year later...

Добрый день!

Чтоб не плодить темы - вопрос похожий.

Модуль CDEK подключает скрипты в head.

 

public function addScripts() {
		$this->document->addStyle('catalog/view/theme/default/stylesheet/sdek.css');
	    $this->document->addScript('//api-maps.yandex.ru/2.1/?lang=ru_RU&ns=cdekymap');
	    $this->document->addScript('catalog/view/javascript/sdek.js'); 

	}

Они выводятся на всех страницах, а нужны только на странице оформления заказа.

попробовал создать условия для подключения скриптов только на нужной странице

public function addScripts($route) {
       if($route == "checkout") {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/sdek.css');
             $this->document->addScript('//api-maps.yandex.ru/2.1/?lang=ru_RU&ns=cdekymap');
             $this->document->addScript('catalog/view/javascript/sdek.js');
       }
    }

скрипты не отображаются.

Что делаю не так?

Edited by pobo3
Link to comment
Share on other sites


6 часов назад, pobo3 сказал:

скрипты не отображаются.

 

6 часов назад, pobo3 сказал:

f($route == "checkout") {

покажите что в $route

Link to comment
Share on other sites

Вот понимать бы еще что там должно быть)

попробовал реализовать по аналогии модуля от производителя - там строчка

public function orderCreate($route, $input_data, $order_id) {
		if($route = "checkout/order/addOrder" && (int)$order_id) {
			$this->rememberCdek($order_id);
		}
	}

понимаю что checkout не правильно по всей видимости, checkout/checkout - тоже не работает.

попробовал способом представленным в начале поста

if ($_SERVER['REQUEST_URI'] == "/simplecheckout")

и

if ($_SERVER['REQUEST_URI'] == "index.php?route=checkout/checkout")

не работает

Link to comment
Share on other sites


  • 8 months later...

@ pobo3

Не знаю, актуально еще или нет, но такую же проблему у себя я решил так:

	public function addScripts() {
		if($_SERVER['REQUEST_URI'] == "/simplecheckout/" || $_SERVER['REQUEST_URI'] == "/index.php?route=checkout/checkout") {
			$this->document->addStyle('catalog/view/theme/default/stylesheet/sdek.css');
			$this->document->addScript('//api-maps.yandex.ru/2.1/?lang=ru_RU&ns=cdekymap');
			$this->document->addScript('catalog/view/javascript/sdek.js');
		}
	}

 

Link to comment
Share on other sites


  • 2 months later...

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
 Share

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