galey1981 Posted October 12, 2008 Posted October 12, 2008 I am building an affiliate site using the OSCommerce package. I have easypopulate and have made a product feed to upload to my catalog. In the product image field I've got absolute image references e.g: http://www.furniture123.co.uk/F123images/C...1/fol007713.jpg When I browse the shop all the images are broken links because it automatically apends my catalog image location to the URL (http://www.myshop.com/catalog/images/then the above link), thus breaking the image reference. Can I modify the product_info page and the product_listing module code so it strips off the bit where it looks for my image directory and will just point to this remote location instead? Any feedback would be massively appreciated. I dont have the level of skill to identify what to remove. Many Thanks, David
Kanie Posted October 12, 2008 Posted October 12, 2008 In product_info.php find this code: document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); And replace it with: document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image($product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); Then find this code: <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> And replace it with: <?php echo '<a href="' . tep_href_link($product_info['products_image']) . '" target="_blank">' . tep_image($product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> Essentially all I have done is removed "DIR_WS_IMAGES . " from the call to the "tep_image" function, so if your code isn't the same as the examples above then try and locate where your product image(s) are called and remove "DIR_WS_IMAGES . " from the call to the "tep_image" function. The same principle is applied for the product listings. In the file includes/modules/product_listing.php find the line: $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; And replace it with: $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image($listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; Then find this line: $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; And replace it with: $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image($listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; There are other files to consider also. The shopping cart, new products, specials and some others all call the product images in the same way, so the exact same principle can be applied in every situation. However, removing this code will permanently prevent you from adding images from your own site by just including the filename in Easy Populate. If you do want to use an image from your site at any point then use the full URL like you are using for the external images, eg. ttp://www.myshop.com/catalog/images/myimage.jpg
galey1981 Posted October 12, 2008 Author Posted October 12, 2008 Hi there - thanks for taking the time to point this all out to me. Really appreciated.
galey1981 Posted October 12, 2008 Author Posted October 12, 2008 Sorry, me again, just went in to try and apply your suggested fix in product_info. I've actually modded this page a bit since the examples you have shown me and the code looks like this: <script language="javascript"><!-- document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image( DIR_WS_IMAGES.(file_exists(DIR_WS_IMAGES.str_replace( '.','_s.',$product_info['products_image']))?str_replace( '.','_s.',$product_info['products_image']):$product_info['products_image']), addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . (file_exists(DIR_WS_IMAGES.str_replace( '.','_s.',$product_info['products_image']))?str_replace( '.','_s.',$product_info['products_image']):$product_info['products_image']), $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> The code is a bit different, not sure how to edit out. Could you look at this variation and make a suggestion?
Guest Posted October 12, 2008 Posted October 12, 2008 Hi there - thanks for taking the time to point this all out to me. Really appreciated. Does this affect your ssl pages?
galey1981 Posted October 12, 2008 Author Posted October 12, 2008 Does this affect your ssl pages? I dont know yet - my code is slightly different to the suggestions made so I havent implemented yet. If I get some help with the modified code i've posted I'll implement it and see what happens.
Guest Posted October 12, 2008 Posted October 12, 2008 I dont know yet - my code is slightly different to the suggestions made so I havent implemented yet. If I get some help with the modified code i've posted I'll implement it and see what happens. It would seem to me that it would be easier to have the images on your site than to hot link to them.
Kanie Posted October 12, 2008 Posted October 12, 2008 David, try this: <script language="javascript"><!-- document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image($product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image($product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> I basically stripped out the modifications, which I felt were redundant since you won't be having control over the images. "Does this affect your ssl pages?" It would if any SSL pages made use of the images, but I don't think any SSL pages do in a standard osCommerce solution.
smilingcreative Posted October 13, 2008 Posted October 13, 2008 Hi There I have done what you have said and its fine in all the page picture is working fine but there is no picuture in my front page all picture links are broken can you please let me know how can i solve this problem for more understanding here is the link of my site http://www.viewsample.co.uk Advanced thanks Regards Rakibul
smilingcreative Posted October 20, 2008 Posted October 20, 2008 Hi there I have done what you said everything is working fine except the front page picture link in the front page are broken but when i click on the details button picure work even all the pages like product_listing.php , product_new.php etc can you please tell me why picture is not working on front page but on the other page Regards Rakibul
Recommended Posts
Archived
This topic is now archived and is closed to further replies.