In oscommerce, I have set the DIR_WS_IMAGES from the config.php to be an external url so that the site loads the images from a static cookie-less subdomain.
The images work fine except the pop-us.
The pop-up scritp echo osc_link_object(osc_href_link(DIR_WS_IMAGES.
will give the following url http://www.example.com/http://subdomain.example.com/products/originals/image.jpg which will not function as its calling main url plus the DIR_WS_IMAGES url.
How can I amend the script to just call subdomain.excample.com
Thanks for any help.
Regs Fabian
This is the code that is giving a double url [http://www.example.com/http://subdomain.example.com] that needs to be corrected to output just the [http://subdomian.example.com]
<?php
$group_id = $osC_Image->getID('originals');
echo osc_link_object(osc_href_link(DIR_WS_IMAGES.'products/'.$osC_Image->getCode($group_id).'/'.$osC_Product->getImage(),null,'AUTO',false), $osC_Image->show($osC_Product->getImage(), $osC_Product->getTitle(), null, 'product_info'), 'target="_blank" rel=""');?>
Appreciate all the help.
Regs Fab
3
Answers
I have managed to correct the problem by simply doing
instead of
Thanks to all does that offered help.
With best regards
Fabian
Quickest and easiest thing to do (and won’t look so out of place in osCommerce’s code) is to do a
preg_replace()
.Even better, dig out the global constant from
includes/config.php
and concatenate it in the regex – be sure to usepreg_quote(SITE_BASE, '/')
(assumingSITE_BASE
is it, can’t think of it right now off the top of my head).May be this post can help you a bit.
http://developerblog.e-cart-solutions.com/2010/10/product-images-images-from-remote-locations/
You can simply restort to replacing the domainname by the sudomain name if the paths are no different using a simple str_replace.
Shiva