Hi Dave,
i have created extra fields which is all fine but when i import a feed
And the field has no data in the feed mysql writes default value of ‘0.00’ can we stop this happening or have I made a mistake somewhere
Kind Regards
Darren
Hi Dave
Thanks for quick response I found the problem it was regex problem i created new preg_replace function to remove all URLs and domain names, hidden links and emails address in including tags and all HTML tags including embedded scripts css styles from product description works perfect now!.
Kind Regards
Darren
Hi Dave,
Back again on this i added this to admin.php
$record[$admin_importFeed["field_delivery_cost"]] = tapestry_decimalise($record[$admin_importFeed["field_delivery_cost"]]);
The problem is it works when feeds have this field present but if i try to import a feed that does not have this field it imports 0.00 in delivery cost field and all my extra feilds is there a way i can put some checks in place if the field is not found to set a deafault value this is i got so far but does not seem to be working?
if ($record[$admin_importFeed["field_delivery_cost"]] == NULL)
{
$record[$admin_importFeed["field_delivery_cost"]] = "See Merchant Shop For Details";
}
elseif($record[$admin_importFeed["field_delivery_cost"]] == 0)
{
$record[$admin_importFeed["field_delivery_cost"]] = "See Merchant Shop For Details";
}
else
{
$record[$admin_importFeed["field_delivery_cost"]] = tapestry_decimalise($record[$admin_importFeed["field_delivery_cost"]]);
}
Kind Regards
Darren
Hi Darren,
I would use the decimalise function first, and then override if it comes out as 0.00, for example:
$record[$admin_importFeed["field_delivery_cost"]] = tapestry_decimalise($record[$admin_importFeed["field_delivery_cost"]]);
if ($record[$admin_importFeed["field_delivery_cost"]] == "0.00")
{
$record[$admin_importFeed["field_delivery_cost"]] = "See Merchant Shop For Details";
}
Cheers,
David.
Hi Dave,
No that did not work still the same what seems to be happening is i am appling tapestry_decimalise to field that does not exsit? because i have not registered shipping cost field for this feed?
I could be well wrong still learning dave after all this time running PT
Best Regards
Darren
Hi Darren,
Ah - that makes sense. In that case, the best approach would be to check the field value rather than $record, and then create a $delivery_cost variable which you then use when constructing the SQL.. For example:
if ($admin_importFeed["field_delivery_cost"])
{
$delivery_cost = tapestry_decimalise($record[$admin_importFeed["field_delivery_cost"]]);
}
else
{
$delivery_cost = "See Merchant Shop For Details";
}
...and then in the SQL, instead of:
database_safe($record[$admin_importFeed["field_delivery_cost"]]),
...just use:
database_safe($delivery_cost),
Hope this helps!
Cheers,
David.
Hi Darren,
That sounds like you've added a DECIMAL field with NOT NULL. If you modify the field to allow NULL values it should default to empty rather than 0.00...
Cheers,
David.