Re: Adding product name

david.houlder's picture
Joined: 05/29/2010
Juice: 131
Re: Adding product name

Hi Mark,

First you need to modify _uc_stock_update_export_product_options() to write the title field to the outpuit file. Something like this should do the trick (changes in bold):

function _uc_stock_update_export_product_options($csv_filename, $headings) {
  return _uc_stock_update_export(
             array('nid', 'title', 'oid', 'model', 'name', 'cost', 'price'),

             "SELECT {node}.nid, title, oid, model, ".
             "{uc_attribute_options}.name, ".
             "{uc_product_options}.cost, {uc_product_options}.price ".
             "FROM {node} INNER JOIN {uc_product_options} USING (nid) ".
             "INNER JOIN {uc_products} USING (vid) ".
             "INNER JOIN {uc_attribute_options} USING (oid) ".
             "ORDER BY model",

             $csv_filename, $headings);

Once you've done that, you have to adjust the array returned by _uc_stock_update_formats() to cater for the new field. e.g.

      'product-options.csv' =>
            t('product option prices'),
            array("PRODUCT_ID",  "product_name", "OPTION_ID",  "sku",
                  "option_name", "Cost", "Price"),
            array(0, 2),
            array(5, 6)

I haven't tested this, but assuming it's free of typos, I suspect it'll work. Let me know if there are any glitches.


Stock & Price CSV Updater 2 By: david.houlder (94 replies) Sat, 05/29/2010 - 22:48