Jump to content

"Also" supplier API product import module-wrong prices


Recommended Posts

Hello,

I am trying to find out why the prices are wrong calculated with this module.

Here is the piece of code:

//Price
  $prekesRRP = $product->Price->UnitPrice;

  //Antkainis + RRP
  if ($prekesRRP < 10) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin1'] / 100);
    } elseif ($prekesRRP < 20) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin2'] / 100);
    } elseif ($prekesRRP < 30) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin3'] / 100);
    } elseif ($prekesRRP < 40) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin4'] / 100);
    } elseif ($prekesRRP < 50) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin5'] / 100);
    } elseif ($prekesRRP < 60) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin6'] / 100);    
    } elseif ($prekesRRP < 70) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin7'] / 100);    
    } elseif ($prekesRRP < 80) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin8'] / 100);    
    } elseif ($prekesRRP < 90) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin9'] / 100);    
    } elseif ($prekesRRP < 100) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin10'] / 100);    
    } elseif ($prekesRRP < 200) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin11'] / 100);   
    } elseif ($prekesRRP < 300) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin12'] / 100);    
    } elseif ($prekesRRP < 400) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin13'] / 100);    
    } elseif ($prekesRRP < 500) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin14'] / 100);    
    } elseif ($prekesRRP > 500) {
        $antkainisRRP = 1 + ($_alsofiltras[0]['margin15'] / 100);
    }

  //URL
  $product_url = Tools::link_rewrite(mb_substr(url_slug($_name . "-" . $product->Product->PartNumber), 0, 128));

  //Цены и скидки Also
  $price = number_format($prekesRRP * $antkainisRRP, 2, '.', '');

Something is wrong with the logic.

For example, the wholesale price is 135 eur, and the margin for this price group (100-200 eur) is 4.5% and the VAT is 21%, so the final price should be 168.795 (after rounding will be 168.80).

But the price after import is 194.12 eur.

I've changed everything I could think of and about, but I still get 194.12 eur or 0.00 eur.

Help with your ideas and experience.

Thank you.

Share this post


Link to post
Share on other sites
  • 4 weeks 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
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More