Hello!
I have check your first message, it will be easier to save the data in the required way with using the update_product_pre hook.
You can search vai preg_match in the $product_data['full_description']. For example, you search for the following pattern:
if (preg_match('/href="dispatch=.*"/', $product_data['full_description'], $matches)) {
foreach ($matches as $match) {
$replace = fn_url($match, 'C');
$product_data['full_description'] = str_replace($match, $replace, $product_data['full_description']);
}
}
or something like this. Not the best solution of course, but it should work :)
Hello cs-cart team,
Thank you very much for your reply.
but what I was asking was not just to change one link, but use whole smarty html. by your example, only if we use certain cs-cart links, then it's ok. but by your example, smarty template can't be rendered.
example you can't render this;
{$product.company_id|fn_get_company_name} provides various {$product.category_id|fn_get_category_name} products and {$product.product_id|fn_get_product_name} published on {$product.timestamp|timeformat} and since then in {$product.city_id|fn_get_city_name} sold {$product.product_id|fn_get_myordertotal_count}.
I have been searching a solution on this and read too many articles by eComLabs` redirect and very clearly understand this;
on product edit page, if we input smarty code on the field, because the product edit page itself is using smarty already, we can't render it right way on the page and as well it will be wrong. I have tried to edit the update.tpl file to see how it works and result is somehow not success.
{$product_data.product_id|fn_print_r}
{if $product_data.short_description|trim}
{assign var="my_short_description" value={$product_data.short_description|trim nofilter}}
{*eval_string var=$my_short_description*}///this line not works here, why? tried eval and eval_string, both not works
{/if}
{eval $my_short_description} ///kind of eval, but outs only
{assign var=“putti” value=“{eval $my_short_description}”} ///kind of eval, but outs only
{$putti|fn_print_r}
{$product_data[‘my_short_description’] = $putti }
{$my_short_description|fn_print_r}
{$product_data[‘my_short_description’]|fn_print_r}
If you know, please, please, please, can you tell me how can I do render the smarty code from db field on update.tpl? or better solution on php with the hooks? or what is your solution?
if you read above, eComLabs redirected me right, ->fetch but it won't work. I already tried on localhost or domain, ultimate or multi-vendor, it won't work. I read many article, there are some of them;
http://www.smarty.net/docs/en/api.fetch.tpl
https://www.smarty.net/docsv2/en/language.function.eval.tpl
https://stackoverflow.com/questions/1866221/smarty-how-to-evaluate-string-as-a-variable
https://stackoverflow.com/questions/4315046/smarty-evaluate-a-template-stored-in-a-php-variable?rq=1
then how we can do achieve this?
this is very important thing, if we can achieve this, then cs-cart is more adaptable with other software like spintext or other anything.
Please help, I believe many cs-cart owners looking for a solution.
Thanks in advance!