Jump to content
dtbaker

Mass Update Module

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

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
nox    0

Hi dtbaker,thanks for your nice job.
my question is, after I update the quantity, both in catalog and in mass updates module all no change.

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
nox    0

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
nox    0

Dear superhero495:

Thanks for you help !
finally I understand both you and Presta-TR are suggest me manually install the massupdate module ,oh god!

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

As a test, I made some little modifications and as a result, only a message on button: "Updating....please wait". I waited for 3 hours...and nothing has changed on button message. lol.

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
Guest
This topic is now closed to further replies.

×