Jump to content
Fórum Script Brasil
  • 0

Problema em um sistema


LuizAlbertosts
 Share

Question

Estou tentando mudar um codigo para que uma loja em prestashop tenha uma quantidade minima de pedido nos produtos... Estou usando esse codigo mas esta dando erro! alguém pode me ajudar?

 

---

$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
 
$minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase)
return '<p class="warning">'.sprintf(
Tools::displayError('A minimum purchase total of %1s (tax excl.) is required in order to validate your order, current purchase total is %2s (tax excl.).'),
Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency)
).'</p>';
 
$minimalPurchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
if (self::$cart->nbProducts() < $minimalPurchase)
return '<p class="warning">'.Tools::displayError('A minimum purchase total of').' '.$minimalPurchase.
' '.Tools::displayError('Products is required in order to validate your order.').'</p>';
---
 
Substituir por:
---
$minimal_purchase = (float)Configuration::get('PS_PURCHASE_MINIMUM');
$produtos = $this->context->cart->nbProducts();
$falta = $minimal_purchase - $produtos;
if ($this->context->cart->nbProducts() < $minimal_purchase)
return '<p class="warning">'.sprintf(
Tools::displayError('O total mínimo de produtos em seu carrinho deve ser %1s produtos, neste momento você tem somente %2s produtos adicionados ao seu carrinho. Adicione mais %3s produtos(s) para finalizar seu pedido.'),
($minimal_purchase), ($produtos), ($falta)
).'</p>';
---
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

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

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...