Fórum OpenCart Brasil

Por um e-commerce livre, confiável e profissional

#74998
Bom dia. Encontrei este arquivo que funciona apenas nas versões 1.5. Ele mostra um alerta no carrinho e no checkout para comprar mais para receber frete grátis.

O ele funciona no vqmod, porém não sei como fazer funcionar na versão 2.2.0.

Alguém poderia auxiliar?

Segue o código:
Código: Selecionar todos
<modification>
    <id>Add Free Shipping Alert</id>
    <version>1</version>
    <vqmver>2.3.2</vqmver>
    <author>Andrei Bogdan (andrei.opencart@yahoo.com)</author>
	<!-- template -->
	<file name="catalog/view/theme/default/template/checkout/shipping_method.tpl">
		<operation>
			<search position="before"><![CDATA[<b><?php echo $text_comments; ?></b>]]></search>
			<add><![CDATA[
				<?php if ($alert) { ?>
				<div class="attention">
					<?php echo $alert; ?>
				</div>
				<?php } ?>
				<?php if ($notify) { ?>
				<div class="success">
					<?php echo $notify; ?>
				</div>
				<?php } ?>
				<br />
			]]></add>
		</operation>
	</file>
	<file name="catalog/view/theme/default/template/checkout/cart.tpl">
		<operation>
			<search position="before"><![CDATA[<div class="cart-total">]]></search>
			<add><![CDATA[
				<?php if ($alert) { ?>
				<div class="attention">
					<?php echo $alert; ?>
				</div>
				<?php } ?>
				<?php if ($notify) { ?>
				<div class="success">
					<?php echo $notify; ?>
				</div>
				<?php } ?>
				<br />
			]]></add>
		</operation>
	</file>
	<!-- language -->
	<file name="catalog/language/english/checkout/checkout.php">
		<operation>
			<search position="after"><![CDATA[$_['text_checkout_shipping_method']  = 'Step 4: Delivery Method';]]></search>
			<add><![CDATA[
				$_['text_alert']                     = 'You can enjoy Free Shipping for an ordered amount of at least <strong>%s</strong>.<br />You only need to order for <strong>%s</strong> more and you will qualify for Free Shipping!';
				$_['text_notify']					 = 'Your ordered amount is larger than <strong>%s</strong>.<br /> You are qualified for Free Shipping.';
			]]></add>
		</operation>
	</file>
	<file name="catalog/language/english/checkout/cart.php">
		<operation>
			<search position="after"><![CDATA[$_['heading_title']          = 'Shopping Cart';]]></search>
			<add><![CDATA[
				$_['text_alert']                     = 'You can enjoy Free Shipping for an ordered amount of at least <strong>%s</strong>.<br />You only need to order for <strong>%s</strong> more and you will qualify for Free Shipping!';
				$_['text_notify']					 = 'Your ordered amount is larger than <strong>%s</strong>.<br /> You are qualified for Free Shipping.';
			]]></add>
		</operation>
	</file>
	<!-- controller -->
    <file name="catalog/controller/checkout/cart.php">
        <operation>
            <search position="after"><![CDATA[
				$this->data['totals'] = $total_data;
            ]]></search>
            <add><![CDATA[
				if( $this->cart->getSubTotal() < $this->config->get('free_total') ) {
					$diff = (float)($this->config->get('free_total') - $this->cart->getSubTotal());
				} else {
					$diff = (float)($this->cart->getSubTotal() - $this->config->get('free_total'));
				}
				if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
					$this->data['notify'] = false;
					$this->data['alert'] = sprintf( $this->language->get('text_alert'), $this->currency->format($this->config->get('free_total'),false,false), $this->currency->format($diff,false,false) );
					
				} else {
					$this->data['alert'] = false;
					$this->data['notify'] = sprintf(  $this->language->get('text_notify'), $this->currency->format($this->config->get('free_total'),false,false) );
				}
            ]]></add>
        </operation>
    </file>
	<file name="catalog/controller/checkout/shipping_method.php">
		<operation>
			<search position="before"><![CDATA[
				$this->data['button_continue'] = $this->language->get('button_continue');
			]]></search>
			<add><![CDATA[
				if( $this->cart->getSubTotal() < $this->config->get('free_total') ) {
					$diff = (float)($this->config->get('free_total') - $this->cart->getSubTotal());
				} else {
					$diff = (float)($this->cart->getSubTotal() - $this->config->get('free_total'));
				}
				if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
					$this->data['notify'] = false;
					$this->data['alert'] = sprintf( $this->language->get('text_alert'), $this->currency->format($this->config->get('free_total'),false,false), $this->currency->format($diff,false,false) );
					
				} else {
					$this->data['alert'] = false;
					$this->data['notify'] = sprintf(  $this->language->get('text_notify'), $this->currency->format($this->config->get('free_total'),false,false) );
				}
			]]></add>
		</operation>
	</file>
</modification>
#75049
Olá,

Evite postar esses códigos no tópico. Se possível poste no pastebin.com e cole o link aqui.

Já tentou procurar uma modificação específica para sua versão?
https://www.opencart.com/index.php?rout ... ing%20free

Gente preciso de ajuda urgente. Na migraç&a[…]

Caro @reds , muito obrigado pela resposta.

PHP 8+ incompatibilidade

Toda tradução para a versão 3[…]

Ola @alex3257 Se você precisa apenas ver […]