0

The old script we had was updating the qty. I added price column to the csv file, then I realized still it only updates the qty. Do I miss any required changes? (Our update script is not specific for certain filed)

old

"sku","qty","stock_code" 

New

"sku","qty","price","stock_code"

updating part in the script

$batchModel = Mage::getSingleton('dataflow/batch');
  if ($batchModel->getId()) {
    if ($batchModel->getAdapter()) {
      $batchId = $batchModel->getId(); 
      $batchImportModel = $batchModel->getBatchImportModel();
      $importIds = $batchImportModel->getIdCollection();  
      $batchModel = Mage::getModel('dataflow/batch')->load($batchId);      
      $adapter = Mage::getModel($batchModel->getAdapter());
      foreach ($importIds as $importId) {
        $recordCount++;
            flush();....

Update:

Something weird I encountered, if I run the profile from admin panel it updates all the fields, how ever running from command line does not have effect! what could cause this?

  • what script you use? – Mujahidh Dec 10 '15 at 8:12
  • I guess you mean "Updating the price and qty". You cannot update the sku through dataflow as it is the unique identifier. – Yiorgos Moschovitis Dec 10 '15 at 8:30
  • You are right, I corrected the title – Zinat Dec 10 '15 at 8:31
  • Please don't add "Closed" or "Solved" to the title, use the SE mechanisms. If you found a solution, post it as an answer (you can accept your own answer after 2 days), and if the question is not relevant anymore because the problem went away on its own, flag it to be closed as "not reprodicible" – Fabian Schmengler Dec 18 '15 at 12:41
1

First of all check if you have any spaces or hidden charachters in you csv column headers. Also capital letters etc.

"price " | " price" | "Price" are not acceptable by Dataflow.

If this is not the case,

somewhere in your script there should be a profileId. I quess this code is part of sth like this

https://gist.github.com/Willboudle/da081bfd0fc1ccf6dbef

Find your profile id (e.g. 3), go to your backend, System | Import/Export | Dataflow - (Advanced) Profiles and please post the "Profile Actions XML"

-- Edit--

If you are using the standard profiles, there is a chance your profile has the option Original Magento attribute names in first row: set to No, and in the field mapping area there is no "price" field or is set to have different header in you csv. For example in tthis image the last line may be missing, or have the marked area different.

If you're using the advanced profiles, the same thing may be happening, but with a bit of extra effort (XML coding).

enter image description here

  • Thanks for the hints. All are set correctly, unfortunately ;) – Zinat Dec 10 '15 at 8:46
  • Where is this field mapping? I couldn't find it – Zinat Dec 10 '15 at 9:15
  • It is only visible if the option "Original Magento attribute names in first row" is set to "No" and only in the standard profiles. In the advanced profiles there are bunch of lines you have to write. Did you find the actual Profile you are running through the script? – Yiorgos Moschovitis Dec 10 '15 at 9:26
  • Yes, I found and the cost is cost and price is price. What makes me wonder is that why only qty is getting updated! Assuming field names are correct, the script either should work for all or none of them.. – Zinat Dec 10 '15 at 9:57
  • If you really need help try posting your whole script and/or the 'Profile Actions XML' of the Dataflow Profile that is called – Yiorgos Moschovitis Dec 10 '15 at 10:23
0

You can refer these two links to do your updates fast and easy.

To Update the Price.

To Update the Qty.

This works fine for me to update my store fast n easy.

  • Should I care about magento version? – Zinat Dec 10 '15 at 8:49
  • Its worked fine for version 1.9. for me.Whats ur magento version? – Mujahidh Dec 10 '15 at 8:51
  • The version is 1.9.2.0, I should give it a try then – Zinat Dec 10 '15 at 8:52
  • I guess with the version table column names are not changing.Just try if it is help you consider accept my answer. – Mujahidh Dec 10 '15 at 8:58
  • Sure I will, hope it works – Zinat Dec 10 '15 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.