New Zenner
- Join Date:
- Jul 2012
- Posts:
- 11
- Plugin Contributions:
- 0
Here's a quick tutorial on how to add fields to easypopulate v1.2.5.4 or 1.2.5.5
lankeeyankee:
In looking at the sql values, the status is being set to 100 and then the rest of your values are off after that. You are inserting 12 values into 11 fields. So somewhere you missed an edit or entered something incorrectly. Go back and check, because it's not products.quantity_order_units in the db table, it's products_quantity_order_units and I bet that was the value of 100 that was trying to be inserted.
For anyone else that comes across this post that is having similar problems, it always helps to look closely at the error message being returned. In this case, you can count that there are 12 values being inserted into 11 fields and can trace which one is throwing the error which narrows down what to look for.
Thanks for the quick reply...
I don't understand why it is getting the status value at the 4th position when, on txt file, it's on the last position, just before the EOREOR. In this upload, that gave this error, the status should be the last value "1".
Before the changes EasyPopulate runs just fine... Before the changes the upload file worked by this order:
v_products_model;v_products_image;v_products_name_2;v_products_description_2;v_products_url_1;v_products_price;v_products_weight;v_date_avail;v_date_added;v_products_quantity;v_manufacturers_name;v_categories_name_1;v_categories_name_2;v_categories_name_3;v_categories_name_4;v_categories_name_5;v_categories_name_6;v_categories_name_7;v_tax_class_title;v_status;EOREOR
I inserted the v_products_quantity_order_units after price and beforeweight.
According to your guidelines, this are the changes I made on the easypopulate.php file:
$header_array = array(
'v_specials_price' => $iii++,
'v_specials_date_avail' => $iii++,
'v_specials_expires_date' => $iii++,
'v_products_price' => $iii++,
'v_products_quantity_order_units' => $iii++,
'v_products_weight' => $iii++,
'v_date_avail' => $iii++,
'v_date_added' => $iii++,
'v_products_quantity' => $iii++,
);
$filelayout_sql = "SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_quantity_order_units as v_products_quantity_order_units,
p.products_weight as v_products_weight,
p.products_date_available as v_date_avail,
p.products_date_added as v_date_added,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id,
p.products_status as v_status
$filelayout_sql = "SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_quantity_order_units as v_products_quantity_order_units,
p.products_weight as v_products_weight,
p.products_date_added as v_date_added,
p.products_date_available as v_date_avail,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id
FROM
$default_these = array(
'v_products_image',
// redundant image mods removed
'v_categories_id',
'v_products_price',
**'v_products_quantity_order_units',**
'v_products_quantity',
'v_products_weight',
'v_date_added',
'v_date_avail',
'v_instock',
'v_tax_class_title',
'v_manufacturers_name',
'v_manufacturers_id',
'v_products_dim_type',
'v_products_length',
'v_products_width',
'v_products_height'
// now do a query to get the record's current contents
$sql = "SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_quantity_order_units as v_products_quantity_order_units,
p.products_weight as v_products_weight,
p.products_date_added as v_date_added,
p.products_date_available as v_date_avail,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id
FROM
// redundant image mods removed
$query .="'".zen_db_input($v_products_model)."',
'".zen_db_input($v_products_price)."',
'".zen_db_input($v_products_quantity_order_units)."',
'".zen_db_input($v_db_status)."',
CURRENT_TIMESTAMP,
$v_date_added,
$v_date_avail,
'".zen_db_input($v_tax_class_id)."',
'".zen_db_input($v_products_weight)."',
'".zen_db_input($v_products_quantity)."',
'$v_manufacturer_id')
";
$query = 'UPDATE '.TABLE_PRODUCTS.'
SET
products_price="'.zen_db_input($v_products_price).
'", products_quantity_order_units="'.zen_db_input($v_products_quantity_order_units) .
'" ,products_image="'.zen_db_input($v_products_image);
// redundant image mods removed
$query .= '", products_weight="'.zen_db_input($v_products_weight) .
'", products_tax_class_id="'.zen_db_input($v_tax_class_id) .
'", products_date_available= ' . $v_date_avail .
', products_date_added= ' . $v_date_added .
', products_last_modified=CURRENT_TIMESTAMP' .
', products_quantity="' . zen_db_input($v_products_quantity) .
'" ,manufacturers_id=' . $v_manufacturer_id .
I also must say that, for existing products on the database, he had the products_quantity_order_units correctly... It just don't let me create/add new products...