PDA

View Full Version : Using Easy Populate and photo URLS rather than filenames



DanDan
02-15-2012, 08:42 AM
I need to add several thousand products to my site. I have the database info from the supplier's site but no product pics, just the photo URLs to insert into the Easy Populate excel file. How can I modify the OSCMax pages to use product URLs from the supplier's site rather than copying all the supplier's pics and uploading them to my site?

Thanks,

Dan

DanDan
02-15-2012, 02:28 PM
I need to add several thousand products to my site. I have the database info from the supplier's site but no product pics, just the photo URLs to insert into the Easy Populate excel file. How can I modify the OSCMax pages to use product URLs from the supplier's site rather than copying all the supplier's pics and uploading them to my site?

Thanks,

Dan


I may have solved the issue myself. On the product.info.tpl.php I changed:



<!-- Image Big Starts -->
<td class="productinfo_imagebig" width="<?php echo PRODUCT_IMAGE_WIDTH; ?>">
<?php
//Set imagezoomer on/off switches image size from big to products
if (IMAGEZOOMER == 'true') {
$imagezoom = ' class="imagezoomer"';
$image_show = DYNAMIC_MOPICS_BIGIMAGES_DIR;
} else {
$imagezoom = '';
$image_show = DYNAMIC_MOPICS_PRODUCTS_DIR;
}
$image_lg = mopics_get_imagebase($product_info['products_image'], DIR_WS_IMAGES . DYNAMIC_MOPICS_BIGIMAGES_DIR);
if ($lg_image_ext = mopics_file_exists($image_lg, DYNAMIC_MOPICS_BIG_IMAGE_TYPES)) {
$image_size = @getimagesize($image_lg . '.' . $lg_image_ext);

//BOF SLIMBOX
$lightlarge = $image_lg . "." . $lg_image_ext;
?>
<script type="text/javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link($lightlarge) . '" target="_blank"' . $imagezoom . ' id="image_big" rel="lightbox[group]" title="'.addslashes($product_info['products_name']).'" >' . tep_image(DIR_WS_IMAGES . $image_show . $product_info['products_image'], addslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT, 'hspace="0" vspace="0"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '<\/a>'; ?>');
//-->
</script>
<noscript>
<?php echo '<a href="' . tep_href_link($lightlarge) . '" target="_blank" rel="lightbox[group]" title="'.addslashes($product_info['products_name']).'" >' . tep_image(DIR_WS_IMAGES . DYNAMIC_MOPICS_PRODUCTS_DIR . $product_info['products_image'], addslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT, 'hspace="0" vspace="0"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
<?php
} else {
if (mopics_file_exists(DIR_WS_IMAGES . DYNAMIC_MOPICS_PRODUCTS_DIR . $product_info['products_image'])) {
echo tep_image(DIR_WS_IMAGES . DYNAMIC_MOPICS_PRODUCTS_DIR . $product_info['products_image'], stripslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT);
} else {
echo tep_image(DIR_WS_ICONS . 'default_lg.png', TEXT_MISSING_IMAGE, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT);
}
}
?>
</td>
<!-- Image Big Ends -->


to:


<!-- Image Big Starts -->
<td class="productinfo_imagebig" width="<?php echo PRODUCT_IMAGE_WIDTH; ?>">




<script type="text/javascript"><!--
document.write('<?php echo tep_image($product_info['products_image'], addslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT, 'hspace="0" vspace="0"') ?>');
//-->
</script>
<noscript>
<?php echo tep_image($product_info['products_image'], addslashes($product_info['products_name']), PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT, 'hspace="0" vspace="0"') ; ?>
</noscript>


</td>
<!-- Image Big Ends -->





On the new_products.php module I changed:



$box_content[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $special_old_price[$x] . '&nbsp;' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])) . $closer[$x] . '<br>' . $more_info . '<a href="' . tep_href_link(FILENAME_CONTACT_US, 'enquiry=' . TEXT_QUESTION_PRICE_ENQUIRY . '%0D%0A%0D%0A' . TEXT_QUESTION_MODEL . '%20' . str_replace(' ', '%20', $new_products[$x]['products_model']) . '%0D%0A' . TEXT_QUESTION_PRODUCT_NAME . '%20' . str_replace(' ', '%20', $new_products[$x]['products_name']) . '%0D%0A' . TEXT_QUESTION_PRODUCT_ID . '%20' . $new_products[$x]['products_id'] . '%0D%0A%0D%0A') . '">' . tep_image_button('button_cfp.gif', IMAGE_BUTTON_CFP) . '</a>');

} else {

$box_content[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $special_old_price[$x] . '&nbsp;' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])) . $closer[$x] . '<br>' . $more_info . '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $new_products[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');

} // end if ($listing[$x]['products_price'] == CALL_FOR_PRICE_VALUE)


to:


$box_content[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image( $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $special_old_price[$x] . '&nbsp;' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])) . $closer[$x] . '<br>' . $more_info . '<a href="' . tep_href_link(FILENAME_CONTACT_US, 'enquiry=' . TEXT_QUESTION_PRICE_ENQUIRY . '%0D%0A%0D%0A' . TEXT_QUESTION_MODEL . '%20' . str_replace(' ', '%20', $new_products[$x]['products_model']) . '%0D%0A' . TEXT_QUESTION_PRODUCT_NAME . '%20' . str_replace(' ', '%20', $new_products[$x]['products_name']) . '%0D%0A' . TEXT_QUESTION_PRODUCT_ID . '%20' . $new_products[$x]['products_id'] . '%0D%0A%0D%0A') . '">' . tep_image_button('button_cfp.gif', IMAGE_BUTTON_CFP) . '</a>');

} else {

$box_content[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image($new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $special_old_price[$x] . '&nbsp;' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])) . $closer[$x] . '<br>' . $more_info . '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'pName')) . 'action=buy_now&products_id=' . $new_products[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');

} // end if ($listing[$x]['products_price'] == CALL_FOR_PRICE_VALUE)




This seems to work with Easy Populate, using image URLs rather than filenames and saves having to save and upload 1000's of images.

I have tested this on my site, does anyone have any suggestions on how to improve the code? I am not a real expert at coding.

Dan