Jump to content

Mass Update Module


dtbaker
 Share

Recommended Posts

The "Mass Update" spreadsheet style update plugin has been created, you are more than welcome to test it.

!http://dtbaker.com.au/code/prestashop/mass_update.jpg!

Install instructions:
* Go the PrestaShop Modules page
* Click Add New Module
* Copy & Paste this url: http://dtbaker.com.au/code/prestashop/massupdate.tar
* Enter your admin password
* Click "Install this module"
* Click install again next to "Mass Update" (in the Products section)
* Then click "Configure" to see the spreadsheet style product editor.

Alternatively, there is a zip that you can unpack manually into the "modules" directory: http://dtbaker.com.au/code/prestashop/massupdate.zip


Note: price bug has been fixed

  • Like 11

Share this post


Link to post
Share on other sites

Yes it's possible to change the "features" rather easily if you feel like messing with a bit of the code. No guarantees.

Future versions will have a config section where you can choose which fields to edit, and possibly "page by page" listings for people who have more than a few hundred products.

Will keep active/deactive flag in mind for when I next have a play with the code.

Dave

Share this post


Link to post
Share on other sites

hmmm... tried installing both ways and I get a 500 error.

Are there any permissions that need setting?

Could it be the number of items in my store (over 3000)?

Any help much appreciated

Share this post


Link to post
Share on other sites

Hi dtbaker,

Thanks for the module, it will be very usefull to me.

I do have one question, looking at your picture of the "mass update module" you have 6 columns showing, I have only 3 showing (see pic) what am I missing ?

All the best, keep up the good work,
Cerberus22

5910_2FCgJ3689Zw2ODCk5Ld7_t

Share this post


Link to post
Share on other sites

Hi dtbaker,

Thanks for the module, it will be very usefull to me.

I do have one question, looking at your picture of the "mass update module" you have 6 columns showing, I have only 3 showing (see pic) what am I missing ?

All the best, keep up the good work,
Cerberus22


Features on the items.

Share this post


Link to post
Share on other sites

Where do you make translations for Save all my products - and Product, price, weight etc.?


at the moment there is only support for 1 language.
if there is enough demand I can create a button that lets you switch between languages in future versions.

Share this post


Link to post
Share on other sites

no run this module. How is work??? i'm copied in modules/ directory and comes modules panel and not previewing..

and massupdate dir deleting comes all modules..

thanks


i had the same problem.
problem is that you tried to install module by url. apache process created the folder and after that you are unable to copy files to your module dir by ftp because of permission of folder. try to delete dir massupdate and then copy it by ftp.
hope it will help you.

Share this post


Link to post
Share on other sites

no run this module. How is work??? i'm copied in modules/ directory and comes modules panel and not previewing..

and massupdate dir deleting comes all modules..

thanks


i had the same problem.
problem is that you tried to install module by url. apache process created the folder and after that you are unable to copy files to your module dir by ftp because of permission of folder. try to delete dir massupdate and then copy it by ftp.
hope it will help you.


thanks for your message but i have try 2 way,

in copied manuelly module directory and installing URL way and not working the module in v1.1 i am copying to modules directory and go to modules page i see free page. Anything is there.. All modules is to disappear..

please help me
this module soo great..
thx

Share this post


Link to post
Share on other sites

hi !
install this module as install instructions says, but nothing...can't see any products ?
any idea ?
thanks


probably it is because your language is not english or not have id_lang=1
i had the same problem.
then i modified select query in modules/massupdate/massupdate.php on line 185:
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON ( f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = 3)';



and on line 192:

LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`) WHERE pl.`id_lang` = 3';



My id_lang=3, if you have different id_lang replace it with yours.

Share this post


Link to post
Share on other sites

why to PRICE row is $???? I want the default price, if is posibile


Just edit modules/massupdate/massupdate.php
Find that code near line 60:

      "price"=>array(
                "db_field"=>"price",
                "friendly"=>"Cena",
                "prefix"=>'$',



Change the array field prefix to your currency symbol. If you want to display currency sign after price rename prefix to suffix.
Enjoy it.

Share this post


Link to post
Share on other sites

Dear Presta-TR

you mean are let me delete the massupdate module ?
I understood that why the quantity value can't update , I successed update the quantity value in attribute.

TKS

Share this post


Link to post
Share on other sites

Superher495 thanks for your answer i 've tryed modification (curency and language of my shop) but...still product list empty, nothing appears ....
grrrrrrr....


I had the same problem. By searching the code I found a third language setting. After changing it to my language-id it worked perfectly.

Regards
Peter

Share this post


Link to post
Share on other sites

Dear Presta-TR

you mean are let me delete the massupdate module ?
I understood that why the quantity value can't update , I successed update the quantity value in attribute.

TKS


i am not installed the module. i copy the modules/ directory and coming the admin panel / modules ; no see any module.
all modules goed. and remove the massupdate directory alls comes back..

thx

Share this post


Link to post
Share on other sites

Great module, thanks for taking the time to do it.

One question, wouldn't it be more practical to have a link within the Admin Catalog section that just says "Mass Update Products"?? that way you don't have to go digging down into the module to do the update.

Share this post


Link to post
Share on other sites

Thank you for this module, it's going to save me a bunch of time when doing price and stock quantity updates.

Is there any way to order the list of products by product name or reference number (I've made a few small changes to the code to also display the reference number of each product which are my own product codes)?

Even better would be the ability to import a csv file with a few selected fields (i.e. just the ref no's and the prices or just the ref no's and the quantities) :-)

Thanks again for an excellent module.

EDIT: Sorry, another question - is there any way to use the "Retail price with tax" instead of the "Pre-tax retail price" used in this module. I had a look at the database to see if I could find a database field for the retail price with tax so that I could just change the ("db_field"=>"price") in the code but I don't see anything that I can use?

Share this post


Link to post
Share on other sites

excellent module dtbaker!

3 questions...

Is it possible to add categories?
Is it possible to add product code/reference?
Is it possible to add button that will make export/import?

tnx!

Share this post


Link to post
Share on other sites

DJ-Terror

I added the product code/reference number in to show just in front of the product name. To do this I simply added some code into the massupdate.php file as follows:

Find (somewhere in the middle of a line, around about line 218):

<?=$product['name'];?>


and insert directly in front of it:

<?=$product['reference'];?>  



Or, if you want the reference number to be editable along with the price, quantity etc then find the following code (around about line 60):

$main_product_fields = array(
            "price"=>array(
                "db_field"=>"price",
                "friendly"=>"Price (Excl.VAT)",
                "prefix"=>'R',
            ),
            "weight"=>array(
                "db_field"=>"weight",
                "friendly"=>"Weight ($weight_units)",
            ),
            "quantity"=>array(
                "db_field"=>"quantity",
                "friendly"=>"Quantity",
            ),
           //add more, eg: quantity, here.



Then add an array for the reference number/product code as follows:

"reference"=>array(
                "db_field"=>"reference",
                "friendly"=>"Product Code",
            ),



Hope that helps, not sure about the rest though.

Share this post


Link to post
Share on other sites

Good work! I have some minor fixes though.
Currency fix (shows default currency sign):

    
function getConfig()
{
   $currencies = Currency::getCurrencies();
   $default_currency = Configuration::get('PS_CURRENCY_DEFAULT');
   foreach ($currencies as $currency) {
       if ($currency['id_currency'] == $default_currency)
           $sign = $currency['sign'];
   }
   $weight_units = strtolower(Configuration::get('PS_WEIGHT_UNIT'));
    $main_product_fields = array(
        "price"=>array(
            "db_field"=>"price",
            "friendly"=>$this->l('Price'),
            "prefix"=> '(' . $sign . ')',
        ),
        "weight"=>array(
            "db_field"=>"weight",
            "friendly"=>$this->l('Weight') . " ($weight_units)",
        ),
        "quantity"=>array(
            "db_field"=>"quantity",
            "friendly"=>$this->l('Quantity'),
        ),
        //add more, eg: quantity, here.
    );
    return $main_product_fields;
}


Language fix (Note that it will still work for one language only):
At the very to of updateProducts() function:

       $language_id = Configuration::get('PS_LANG_DEFAULT');


Do the same for getContent() function.
Then near the end of updateProducts() function remove the

$language_id = 1;


getContent() function:
There are 2 SQL statements in it. Look for:

fl.`id_lang` = 1


Change it to:

fl.`id_lang` = '.$language_id.'


Then in the second SQL statement look for:

pl.`id_lang` = 1


Change to:

pl.`id_lang` = '.$language_id.'


Then look for this line:

$all_products = Product::getProductsProperties(1,$all_products);


Change it to:

$all_products = Product::getProductsProperties($language_id,$all_products);


That should do it.
Also, if you have a lot of product attributes, table stretches too much, you can do this to fix this issue:
Look for <table cellspacing="0" cellpadding="0" class="table space" width="98%" align="center">
Select whole table (everything between

tags) and replace it with this code:
>
</pre>
<table cellspacing="0" cellpadding="0" width="98%" align="center"><?= $this->l('Product');?><?= $this->l('Accessories');?>
<?=$product['name'];?>
<?=$f['friendly']?> <?=$f['prefix'];?>
              <input type="text" style="width: 90%;" value="<?=$product[$f['db_field']];?>" name="mup[<?=$product['id_product'];?>][<?=$f['db_field'];?>]"/><?=$f['suffix'];?>
<?=$v['name']?>
              <input type="text" style="width: 90%;" value="<?=$feature_value;?>" name="mup[<?=$product['id_product'];?>][ff][<?=$v['id_feature'];?>]"/>
</table>


The last one will make your table longer (or higher, if you wish).
Please test this on your local machine first, I'm a human, so I might have forgotten something :)

Share this post


Link to post
Share on other sites

Hi Dave,
Have found out your module and sure it was a missing tool !
Would be very interested in choosing fields, and found to you planned to it

Yes it's possible to change the "features" rather easily if you feel like messing with a bit of the code. No guarantees.

Future versions will have a config section where you can choose which fields to edit, and possibly "page by page" listings for people who have more than a few hundred products.

Will keep active/deactive flag in mind for when I next have a play with the code.

Is that version aviable at this time ? if so thanks to tell installation link or procedur

Cheers,
Bill

Share this post


Link to post
Share on other sites

This is a great module! I have found a bug, I think. I wanted to change the quantity to 0 because I am awaiting shipment on some of my items and it will not change the quantity. I then attempted to change the quantity to 1 and it updated. So, it does not update the quantity in mass update if the quantity is 0. I'm not sure if any others will mind this but I wanted to report it.

Share this post


Link to post
Share on other sites

Hi all,
What have I missed ?

When I press the "save all my products" is says "please wait" but nothing happens, also the module seems to add an extra 4 zeros to the end of the price (see pic). I have tried the "original version" and also the "updated" massupdate.php file from this post.

What have I done wrong ?

All the best,
Cerberus22

6298_OtLbGVj9VIc9tXTkZGrk_t

Share this post


Link to post
Share on other sites

hi

could you make a tar archive. It will be easier to install it directly. I'm on mas it's not too simple

many thanks (i have a probleme with a ftp install, it don't appears in the BO)

Many thanks this module it's a very very very good idea

Share this post


Link to post
Share on other sites

Seem to be a Great module, but when I try to make any change the button say “Updating.... Please wait....” and nothing happen …

Please help.



This happens to me too. Is there a fix for this?

Share this post


Link to post
Share on other sites

Seem to be a Great module, but when I try to make any change the button say “Updating.... Please wait....” and nothing happen …

Please help.



This happens to me too. Is there a fix for this?


I have he same problem :down: .Anyone knows how to fix it? I think this module is great. It would be even greater if it works for me as well :-)

//peej

Share this post


Link to post
Share on other sites

Good News for everyone using this module, i've found away to get the module to save. The only other problem is that it doesn't seem to work on all you items. Will have to do further investigation on what is wrong.

The Solutions:
On line 199

<input type="submit" class="button" name="go" value="<?= $this->l('Save All My Products');?>" onclick="this.value='<?= $this->l('Updating.... Please wait....');?>'; this.disabled=true;" />


change to this

<input type="submit" class="button" name="go" value="<?= $this->l('Save All My Products');?>" onclick="this.value='<?= $this->l('Updating.... Please wait....');?>' this.disabled=true;" />


and do the same thing on line 246, which is the exact duplicate submit button.

If anyone can figure out why it doesn't work on all items it would be great.

Share this post


Link to post
Share on other sites

Thanks Link Matrix.

I tray your solution and the mass update starting save some items as you say. I think the problem updating some items have some to do with attributes. I tray with some items with attributes and in this cases the mass update don’t save the changes.

Share this post


Link to post
Share on other sites

Hi everybody and many thanks for this loveless module. It's sounds pretty good but i have an error (repeat and repeat) when i try to configure it

NB i'm on 1.2 SVN 667

Notice: Undefined index: rate in /var/www/vhosts/mysite/httpdocs/mydir/classes/Product.php on line 1135

Notice: Undefined index: id_image in /var/www/vhosts/mysite/httpdocsmydir/classes/Product.php on line 1779



An idea ?

Share this post


Link to post
Share on other sites

Thanks Link Matrix.

I tray your solution and the mass update starting save some items as you say. I think the problem updating some items have some to do with attributes. I tray with some items with attributes and in this cases the mass update don’t save the changes.


For a store like mine that is light on product attributes. This fix has worked perfectly for me.

Share this post


Link to post
Share on other sites

Seem to be a Great module, but when I try to make any change the button say “Updating.... Please wait....” and nothing happen …

Please help.



This happens to me too.


No offense.. but if you read the thread... THERE IS A FIX..

Share this post


Link to post
Share on other sites

Im sorry as I just downloaded this I would have thought the owner would have updated his code. Well that's what I would do and if you think Link Matrix's solution works then why does he say doesnt update all products.

Share this post


Link to post
Share on other sites

Hello and thanks for this module
But i have a big problem
I put a quantity to 1 or 2 or 999 : Very nice
If i put a quantity = 0 : the update is not OK, the quantity is not update

So it seems if you try to update with a quantity = 0 : the update is wrong

Is there someone have a solution ?
---------------------------------------------------------------------------------------
Merci d'excuser mon trres mauvais anglais, i'm French :)
Donc si j'essaie de mettre des quantités à 0, ma modification n'est pas prise en compte lors de l'enregistrement
alors que je n'ai aucun problème avec d'autres valeurs
Est ce que quelqu'un aurait une solution ?
Alors que si je vais mettre à 0 dans la fiche produit .... massupdate me restitue bien ce 0 dans la quantité ......

Merci de votre aide

Share this post


Link to post
Share on other sites

Hi, this things works and is FANTASTIC, really, great module

I want to add a new column: available_now

this is because I use this field to publish the price of my products in other stores.

And this module would be great to update the prices quickly.

Can anybody help me?

Share this post


Link to post
Share on other sites

hello

i try to have active / no active colum but if the product is no active i cant active it but if the product is active i can't unactive it
why ?

here is the code

" Status"=>array(
"db_field"=>"active",
"friendly"=>"Status",
),

Share this post


Link to post
Share on other sites

Hello,

This module seems to be fine but i can't use it.
I get a "parsing error" when i try to install it (i tried both way).

Any ideas ? thanks

Sapher

EDIT: i'm working on the SVN version. i tried on the standard 1.1 version and it works

Share this post


Link to post
Share on other sites

Thanks for this nice and useful module. I had a few problems with the original module, I don't know how much of it was fixed in this thread. I just fixed them and thought others might have the same problems too.

This fixes the following issues:
-The save button does not work on IE. When clicked the button label changes but the page is not updated.
-When a value of 0 is set in any field, it is not updated.

It is also set to use the language of the logged in employer.

massupdate.zip

Share this post


Link to post
Share on other sites

Thanks for this nice and useful module. I had a few problems with the original module, I don't know how much of it was fixed in this thread. I just fixed them and thought others might have the same problems too.

This fixes the following issues:
-The save button does not work on IE. When clicked the button label changes but the page is not updated.
-When a value of 0 is set in any field, it is not updated.

It is also set to use the language of the logged in employer.


Could you possibly modify it to break it up into different "pages" for stores that have a lot of products?

Share this post


Link to post
Share on other sites

Sorry
Notice: Undefined index: rate in /var/www/vhosts/mysite/httpdocs/mydir/classes/Product.php on line 1135

my 1135 line

$tax = floatval(Tax::getApplicableTax(intval($result['id_tax']), floatval($result['rate'])));



Notice: Undefined index: id_image in /var/www/vhosts/mysite/httpdocs/mydir/classes/Product.php on line 1779

my 1779 line

if (!$row['id_image'])



and in the table i have this everywhere
Notice: Undefined index: prefix in /var/www/vhosts/mysite/httpdocs/mydir/modules/massupdate/massupdate.php on line 221

my 221 line

<?=$f['prefix'];?><input type="text" style="width: 40px;" value="<?=$product[$f['db_field']];?>" name="mup[<?=$product['id_product'];?>][<?=$f['db_field'];?>]"/><?=$f['suffix'];?> <? }  foreach($feature_results as $k=>$v){ 



many thanks

Share this post


Link to post
Share on other sites


Thanks for the great module, has save me no end of time already, now that I have installed the update which allows me to save in IE7!!

More functions that would be really cool would be the ability of attaching html code into long description fields, but I guess these would prove problematic to code.

I currently have all the products setup but need to reduce all the sale price percentages, which will take ages as I have nearly a thousand products :-)

I was wondering if its possible to add a column to edit the sale price percentage? -

Thanks in advance,

James.

Share this post


Link to post
Share on other sites

LOOK HOW MANY HAPPY PEOPLE. this is a good module and I think it is going to be soo popular.

I wish i can do the following changes:
-Features values to pick from drop down instead of typing in
-To be able to change the product name and have a little icon next to the product to link to the product page instead of hyper ling the product name
-To show/edit refrerence and EAN13
-To show and Edit discount and discount amount 0/1 as well
-to have a save bottun (like a little floppy) next to each line

thanks

Share this post


Link to post
Share on other sites

can someone reply to tell us if we can add fields as stated above?

Another question: as the page have only so many pixels (size) to fit some fields, could we have a configuration area/or file to tell it what fields we want to change/display in the module?

Share this post


Link to post
Share on other sites

Hello to all.
Is possible add the following fields?

Name
Meta title
Meta description
Meta keyword
URL friendly
Tags


Like?
Thanks



you can easely update these using phpmyadmin with a CSV import, would even be easier then adding them to this tool.

Share this post


Link to post
Share on other sites

Why would you update with CSV? if you just want to tweak a couple of fields for a couple of products, would it be worth updating the whole database? replacing products and generating images (that is if the csv import works all the time).

there are 6 pages of this thread with happy people trying to enjoy this module.

I have made the fields wider on mine

           <?php foreach($all_products as $product){
                   $product['price'] = $product['db_price']; // price hack
                   ?>  <?=$product['name'];?> <? foreach($main_fields as $m=>$f){ ?>
<?=$f['prefix'];?><input type="text" style="width: 30px;" value="<?=$product[$f['db_field']];?>" name="mup[<?=$product['id_product'];?>][<?=$f['db_field'];?>]"/><?=$f['suffix'];?> <? }  foreach($feature_results as $k=>$v){ 
                           // what value is in this feature?
                           $feature_value = '';
                           foreach($product['features'] as $f){
                               if($f['id_feature']==$v['id_feature']){
                                   $feature_value = $f['value'];
                               }
                           }
                           ?> <input type="text" style="width: 62px;" value="<?=$feature_value;?>" name="mup[<?=$product['id_product'];?>][ff][<?=$v['id_feature'];?>]"/></td> <?php 
                       } 
                       ?>      <? 
               } 



Anyone can help add fields

Share this post


Link to post
Share on other sites

A little tip to those who have lost all the modules after installing this module.

This Zip file comes with massupdate.zip name. When you unzip, there you get a folder name MASSUPDATE. Inside this folder, there is another folder with same name. Try to copy that inner folder to upload to modules folder. I hope your modules list will be back after that.

Share this post


Link to post
Share on other sites