R
R
Roman2021-10-05 15:30:28
opencart
Roman, 2021-10-05 15:30:28

Opencart. location. Forwarding?

Perhaps the question was not correctly posed. In general, there is a modifier that, instead of the basket, redirects to a link from the location field.

<modification>
    <name>Location redirection</name>
    <code>location-redirection</code>
    <file path="catalog/controller/checkout/cart.php">
  <operation> 
      <search><![CDATA[			if (!$json) {]]></search>
      <add offset="0" position="before"><![CDATA[			$json['error'] = true;]]></add>
  </operation>
  <operation> 
      <search><![CDATA[$json['redirect'] = str_replace('&amp;', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));]]></search>
      <add offset="0" position="replase"><![CDATA[$json['redirect'] = $product_info['location'];]]></add>
  </operation>
    </file>
    <file path="catalog/view/theme/default/template/product/product.tpl">
  <operation> 
      <search><![CDATA[			$('.form-group').removeClass('has-error');]]></search>
      <add offset="0" position="after"><![CDATA[
      if (json['redirect']) {
      location = json['redirect'];
      } ]]></add>
  </operation>
  </file>
    <file path="catalog/view/javascript/common.js">
  <operation> 
      <search><![CDATA[location = json['redirect'];]]></search>
      <add position="replace"><![CDATA[window.open(json['redirect']);]]></add>
  </operation>
  </file>
</modification>

How to make an automatic redirect to a link? And the second question does not open in a new window, how?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question