| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
smarty concatenation/modifer problem | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
smarty concatenation/modifer problem
I've got the following piece of code:
Code:
I need change the "adjust" the value for tmbn_url so that it is a complete path to the thumbnail ie: http://www.mysite.com/images/T/tn_partnumber.jpg Now the $parts[part].image path has data right from table xcart_images_T that looks like ".\images\T\tn_partnumber.jpg" The $parts array also has many other fields such as productid, productcode, filename (of the T image), etc. Can someone help me piece these chunks together to make a path or more specifically, how do I replace the "." in the image_path with http://www.mysite.com and change the \ to / ?? Thanks.
__________________
Adam X-Cart Gold 4.4.5 - Live X-Cart Gold 4.1.11 - Retired X-Payments 1.0.4 CDSEO Pro EWD Hosting |
|||||||
#2
|
|||||||
|
|||||||
Re: smarty concatenation/modifer problem
Sounds like you have something custom going on here. You really shouldn't try to do this in Smarty, it should be done by the PHP that is providing the $parts array to your template.
If you look at product.php you'll see that it uses func_select_product to get product information into an array before making it available to the product.tpl template. func_select_product uses func_get_image_url to turn the image file name in the database into a real URL. It would be best if your custom code did the same thing - use func_select_product to get product data so that all of the array elements work just like you are used to in the stock templates.
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
#3
|
|||||||
|
|||||||
Re: smarty concatenation/modifer problem
Yes its custom. What I've done is made a product (auto parts in our case) look up based on vehicle make, model, year. Once you've picked your vehicle the "results" page which is my modified products.tpl shows all the parts that fit you car. But I need more info in the $products array than xcart provides such as part position, qty per position, notes, power steering, 4WD, bodystyle, etc. in order to correctly narrow down the search on the results page.
My make, model, year results array is somewhat abbreviated compared to $products. I'll attempt to modify and get it more inline with $products. Also, the buy-now button on my results page is not working correctly either. I'm assuming it's due to the fact that I'm missing some of the info from $products array. BTW, why does my custom lookup work on my local WAMP server but not on the Unix server the site is located at? It is successfully using image.php to pull the images on my 'results' page, but on products.php page after a category search, the sourcecode shows the thumbnail images with a complete path. Another thing, my admin side is using image.php to get images for the product page and it is not working either with no custom code on the admin side. Any thoughts?
__________________
Adam X-Cart Gold 4.4.5 - Live X-Cart Gold 4.1.11 - Retired X-Payments 1.0.4 CDSEO Pro EWD Hosting |
|||||||
#4
|
|||||||
|
|||||||
Re: smarty concatenation/modifer problem
Solution or work around found. Found an old post that addressed the difference between Windows using \ in the URL and Unix using /. Changed all the backslashes to forwardslashes and all's well again. Solved the image problem in the backend and my missing thumbnails.
__________________
Adam X-Cart Gold 4.4.5 - Live X-Cart Gold 4.1.11 - Retired X-Payments 1.0.4 CDSEO Pro EWD Hosting |
|||||||
#5
|
|||||||
|
|||||||
Re: smarty concatenation/modifer problem
Quote:
The best way to deal with this is to use func_select_product to get the product data and merge your additional data into the product array it returns or assign your additional data array to a different smarty variable. Quote:
__________________
Manuka Bay Company X-Cart Version 4.0.19 [Linux] UGG Boots and other fine sheepskin products http://www.snowriver.com |
|||||||
|
|||
X-Cart forums © 2001-2020
|