Jump to content

Dynamic pricing


WStefanko

Recommended Posts

Hello all, I am working on a jewelry manufacturing site. Since my prices are based on a daily gold market and weight of an item, is it possible to have Prestashop pricing reference an external site that would be updated daily? I know I could do a mass change but I would have to do that everyday by percentage. Right now I have all of my products on a very complicated excel file that I did not make.

 

Thank you,

Wes

Link to comment
Share on other sites

  • 2 weeks later...

@elpatron, I have figured out away to update my pricing directly to the DB at ps_product_shop in the "price" field. I had some help from my brother. My next question has to do with php/js. Would you know where to edit the "impact on price" files that would allow me to change my attribute by percentage(* or /) instead of (+ or -). I believe this is the last step before I import my products.

Thank you,

Wes

Link to comment
Share on other sites

I looked at this, if you wanted to change all products by a flux rate (i.e. not have a flux rate by product/category).

 

you could do it this way:

 

create a file call FluxRate.php add the following code and file --> classes/FluxRate.php

<?php
 if ((!$specific_price OR $specific_price['price'] == 0) AND $id_currency != (int)(Configuration::get('PS_CURRENCY_DEFAULT')))
 {
  $fluxrate = 10;
  $price = $price * (1 + ($fluxrate / 100));
 }

 

$fluxrate above is set at 10%.

only does it for products, i.e. no attributes and only when in default currency

 

then find the following code (around line 1851 for 1.4) in classes/Product.php

 if (!$specific_price OR !($specific_price['price'] > 0 AND $specific_price['id_currency']))
  $price = Tools::convertPrice($price, $id_currency);

and add the folloing after these two lines

 if (!$specific_price OR !($specific_price['price'] > 0 AND $specific_price['id_currency']))
  $price = Tools::convertPrice($price, $id_currency);
 include('PriceFlux.php');

 

note: this is just a hack with very little testing...but basically it worked on my test machine.

 

of course then you would just change $fluxrate to fit suit your needs

Edited by elpatron (see edit history)
Link to comment
Share on other sites

basically the code could be applied later in Product.php....i.e. before tax calculation but after attributes...

 

I have a module in development in this area...but not specifically for your requirement. Though (that I may in the future if there isn't another module that already does this...

 

have you researched one of the many mass update modules?

Link to comment
Share on other sites

p.s. I looked at the link...what a mess...would take time to sort it out...

 

personally I like to do things simple...that just seems like a lot of work...

 

not knowing how you want to specifically fluctuate prices, the example I gave was for product base price...there are many ways to skin a cat.

Link to comment
Share on other sites

Thanks for the help. My products cannot be adjusted by percentage once uploaded to the server(too much involved). My attributes change by percentage off of the price I upload. So in the products-combination generator you can put a value in the "impact on price:) field that either adds or subtracts to the base price. I am looking for where that is stored in the core. I would think you should just have to change the signs from +- to */ somewhere.

Thanks again

Link to comment
Share on other sites

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