Question

Pour un produit que j'ai une règle de prix catalogue et le prix de niveau.

Quand j'ajouter l'article au panier Magento prend toujours le prix le moins. Est-il possible de le mettre à prendre prix selon la règle du prix catalogue toujours?

Je cherchai mais n'a pas obtenu une solution pour cela. Y at-il des paramètres d'administration pour cela?

Était-ce utile?

La solution

Le code qui commande le prix peuvent être trouvés dans Mage_Catalog_Model_Product_Type_Price

public function getFinalPrice($qty=null, $product)
{
    if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) {
        return $product->getCalculatedFinalPrice();
    }

    $finalPrice = $product->getPrice();
    $finalPrice = $this->_applyTierPrice($product, $qty, $finalPrice);
    $finalPrice = $this->_applySpecialPrice($product, $finalPrice);
    $product->setFinalPrice($finalPrice);

    Mage::dispatchEvent('catalog_product_get_final_price', array('product'=>$product, 'qty' => $qty));

    $finalPrice = $product->getData('final_price');
    $finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);

    return max(0, $finalPrice);
}

Dans _applyTierPrice

$finalPrice = min($finalPrice, $tierPrice);

et par _applySpecialPrice

$finalPrice     = min($finalPrice, $specialPrice);

Il n'y a pas d'options impliquées et renverront le prix minimum.

À mon avis cela correspond également à l'attente du client!

Si vous voulez modifier ce comportement, vous pouvez observer l'événement catalog_product_get_final_price et utiliser $ product-> setData ( 'final_price', X.YZ); à la valeur que vous voulez.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top