Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Buy now button under star product image?


Guest

Recommended Posts

Posted

<?php

 

function tep_star_product_with_attributes($products_id) {

$attributes_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "'");

$attributes = tep_db_fetch_array($attributes_query);

 

if ($attributes['count'] > 0) {

return true;

}

else {

return false;

}

}

 

$star_products_query = tep_db_query("select substring(pd.products_description, 1, 598) as products_description, p.products_id, p.products_image, p.manufacturers_id, p.products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_tax_class_id, sp.product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_STAR_PRODUCT . " sp left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pd.products_id and p.products_status = '1' and pd.products_description != '' and p.products_id=sp.product_id and pd.language_id = '" . $languages_id . "'");

$star_products = tep_db_fetch_array($star_products_query);

$star_products['products_name'] = tep_get_products_name($star_products['products_id']);

 

if (!tep_star_product_with_attributes($star_products['products_id'])) {

$star_products["0"] = array('align' => 'center',

'params' => 'width="100%" valign="top"',

'text' => '<tr>

<td height="15%" width="85%" class="star-product-title">' . $star_products['products_name'] . '</td>

<td align="right" height="100%" width="15%" rowspan="2"><a href="' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $star_products['products_id']) . '"' . ' target="popup"' . ' onClick="window.open(this.href, this.target, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' . SMALL_IMAGE_WIDTH . ', height=' . SMALL_IMAGE_HEIGHT . '\').focus(); return false;">' . tep_image(DIR_WS_IMAGES . $star_products['products_image'], $star_products['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2) . '</a></td>

</tr>

<tr>

<td height="80%" width="85%" class="star-product">'. $star_products["products_description"] . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . '</a></td>

</tr>

 

<tr>

<td align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . '</a>' . tep_draw_separator('pixel_trans.gif', '10', '10') . '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $star_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_IN_CART) . '</a></td>

</tr>');

$star_products_output = array_slice($star_products, sizeof($star_products)-1);

new contentBox($star_products_output);

}

 

else {

$star_products["0"] = array('align' => 'center',

'params' => 'width="100%" valign="top"',

'text' => '<tr>

<td height="15%" width="85%" class="star-product-title">' . $star_products['products_name'] . '</td>

<td align="right" height="100%" width="15%" rowspan="2"><a href="' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $star_products['products_id']) . '"' . ' target="popup"' . ' onClick="window.open(this.href, this.target, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' . SMALL_IMAGE_WIDTH . ', height=' . SMALL_IMAGE_HEIGHT . '\').focus(); return false;">' . tep_image(DIR_WS_IMAGES . $star_products['products_image'], $star_products['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2) . '</a></td>

</tr>

<tr>

<td height="80%" width="85%" class="star-product">'. $star_products["products_description"] . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . '</a></td>

</tr>

<tr>

<td height="5%" width="85%" class="star-product-price" align="center">'.

$currencies->display_price($star_products['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>

</tr>

<tr>

<td align="right"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/more_info.gif') . '</a>' . tep_draw_separator('pixel_trans.gif', '10', '10') . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $star_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_IN_CART) . '</a></td>

</tr>');

new contentBox($star_products);

}

?>

 

I added align="right" to the begining of the code for the buy now button which has moved it from the left to the right but there apears to be a hidden table or image stopping it from sitting underneath the star product image which is where I would like it to be.

Could anyone help to change the code so it will make the buy now button sit underneath the image?

 

see: www.flat4online.co.uk

 

TIA

 

Windows

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...