Jump to content

Recommended Posts

NewPriceImport.phpThis script let's you update prices of simple and combination products based on reference using a csv file.
So you only need a csv file with the first column filled with references and the second column with end prices of the products/combinations (tax excl).

How to use

Place the file 'NewPriceImport.php' in the root of your webshop. Then visit your the page yourdomain.com/NewPriceImport.php . Here you can upload a single file. This file has to have a .CSV extension. Once uploaded the script will update all the prices of simple and combination products. Just as a safety feature, when you are done you should delete the file from your server again.

How does the CSV file look?

The first column of the file should only contain all the references (simple or combination products). The second column should only contain the NEW price. That is it, nothing more, nothing less. This means, you don't have to think about the original 'impact of price' what Prestashop uses with combination products. You only use the final price in the csv file. (Make sure you use a comma separated .csv file)

NewPriceImport.php

29 Sept 2020 Version 1.1 - Bug fix if simple product is empty combination product still updates

Warning:

This file is not protected and does not use the recommended functions.
Using mysqli, not checking $ _POST values etc.
That's why, after using the script delete it from your server again.


Feel free to make improvements to the script on my Github.
(here you can also find a example csv sheet)

 

Edited by Inform-All (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Warning !
This file is not protected and does not use the recommended functions.
Using mysqli, not checking $ _POST values etc.
Any shop risks having its catalog destroyed with this kind of code!
No login or pass

Share this post


Link to post
Share on other sites
34 minutes ago, Eolia said:

Warning !
This file is not protected and does not use the recommended functions.
Using mysqli, not checking $ _POST values etc.
Any shop risks having its catalog destroyed with this kind of code!
No login or pass

That's why, after using the script delete it from your server again.
I've been using it for some of my customers, and i think it is a function that Prestashop should have by default.
So i thought, why not share it :)

Share this post


Link to post
Share on other sites

If you have a list of references, and use the 'normal' import function of Prestashop, it does not update the combination products and it also creates new products for all the not existing products. Also for combinations you only need to import the end price, not the 'impact on price'.

Share this post


Link to post
Share on other sites
18 minutes ago, Inform-All said:

it also creates new products

Oh I see. This should be a bug for PS 1.7. With PS 1.6. you can import combinations by reference AND product ID. For PS 1.7. the Product ID is ignored in this case. For me a bug.

Share this post


Link to post
Share on other sites
4 minutes ago, selectshop.at said:

Oh I see. This should be a bug for PS 1.7. With PS 1.6. you can import combinations by reference AND product ID. For PS 1.7. the Product ID is ignored in this case. For me a bug.

I guess it's not a bug. PS 1.6 had the same behaviour, for some reason it's not possible to update prices for combination and simple products in one csv file. For PS1.6 I also made a module back then.

Edited by Inform-All (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Are you sure ? I cannot confirm in 100% because I'm using Presta Store Manger for to mass update shops. And added this on the bug tracker as well, cause I'm sure it was possible in the past with PS 1.5 and PS 1.6. older versions (before I got PSM).

Share this post


Link to post
Share on other sites

Well. As I told before, there is no need for to use an extra module or script. You can import price combinations by native csv Prestashop import from back-office. You need to select combinations import and select the product(combination)_reference as key. Then combinations will be increased by the price stated on csv.

See here on bug tracker: https://github.com/PrestaShop/PrestaShop/issues/17207

 

  • Like 1

Share this post


Link to post
Share on other sites

Why i made the script:
My customer has a accounting program where people edits prices. Next to this program they have a Prestashop running.
With this script you can simple export simple AND combination products in one csv file, without all the extra info but the reference.


If you think my script is not useful for others, by all means take this topic down... But i thought my PS.16 module was downloaded a couple of hundred times, people might like this script to.

Share this post


Link to post
Share on other sites
  • 1 month later...
On 2/29/2020 at 6:39 PM, Gipielle said:

I've try but with PS 1.7.6.3 it does not work 

i have the message Price Update Done! but nothing appens

Hi,

If the reference does not exists in your Prestashop it does not do anything with that line in the .csv file.
Are you sure your .csv file is comma separated? 

Share this post


Link to post
Share on other sites

Hello, thanks for the replay, yes the same we use to add products to prestahop

maybe it's a good idea to add separetor selection like in prestashop import, so you can view if the file is correctly taken by the php program

Share this post


Link to post
Share on other sites
12 hours ago, Gipielle said:

Ok, found the error (csv not correct), but with 15000 products it goes in timeout

Good to hear you got it working.  :)
The timeout is probably a server setting, maybe this helps.

Share this post


Link to post
Share on other sites
  • 1 month later...
1 minute ago, IgorSB said:

Work on simple price, but not combination price on v1.7.6.4. , what is problem? 

Do your combinations have references added? 
I've tested it on 1.7.6.4 and it works, so i need more info to help you :)

Share this post


Link to post
Share on other sites

Yes, for test I have two combinations in product with reference field 345346346 and 3453463461, price 0,00 and empty reference in base product fields.

I have try multiple uploads of csv, always same: simple product update price work, combination update price not work. Please, give me advice. 

Edited by IgorSB (see edit history)

Share this post


Link to post
Share on other sites
  • 3 months later...
13 minutes ago, Nickovitshj said:

I'm guessing this won't work when I want to edit just one of my stores when running multistore?

If the specific multistore does not have unique references, it does not work. It will update all the prices (for all stores).

Share this post


Link to post
Share on other sites

Shame, i've got multiple stores with exactly the same products. Means they also share the same references.
But I want to only upload one file per store.

Do you have any idea wether another module could help me with this?
I've been looking all over but haven't found one that i'm 100% sure of.

Share this post


Link to post
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...

Important Information

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