chrometweaks.org

Domain Names/iPage hosting services just sent you a refund?

Click Here To View All Answers...


First question I have is Domain Names/iPage hosting services just sent you a refund? Hoping for any comment. Another question on my mind: I have this code :.

$info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' => 'class="smallText" width="33%" valign="top"',.

                                          'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));.

And would like to a "buy now" button....

THis piece works in "products new".

           <td align="right" valign="middle" class="main"><?php echo '<a href="'tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action'))'action=buy_now&products_id='$products_new['products_id'])'">'tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART)'</a>'; ?></td>.

Could you please help me?..

Comments (117)

Hmm... I need to find out myself. I don't know what is the right answer. I'll do some Googling and get back to you if I bump into an useful answer. You should email the people at iPage as they probably know..

Comment #1

OK, looked at it now. Scratch whatever I said above. My code assumes the use of a qty box. Without it, the code needs to be modded a bit..

Just to be clear as to what file I'm working with here ....

/catalog/includes/modules/new_products.php.

FIND:.

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);.

ADD BELOW:.

   $bn_text = tep_draw_form('buy_now', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))'action=buy_now&products_id='. $new_products['products_id']), 'POST')tep_draw_input_field('buyqty', '1', 'size=2 maxlength=2')tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle')'</form>';.

Then find:.

'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$new_products['products_id'])'">'tep_image(DIR_WS_IMAGES$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$new_products['products_id'])'">'$new_products['products_name']'</a><br>'$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));.

Change to:.

'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$new_products['products_id'])'">'tep_image(DIR_WS_IMAGES$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$new_products['products_id'])'">'$new_products['products_name']'</a><br>'$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))'<br>'$bn_text);..

Comment #2

Thanks a lot Acheron..

In fact the file i'm working with is the featured products > featured.php in catalog\includes\modules (it is a contribution).

I cound't get yet the code to work....

Here's the entire file:.

<?php.

/*.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2002 osCommerce.

 Released under the GNU General Public License.

 .

 Featured Products V1.1.

 Displays a list of featured products, selected from admin.

 For use as an Infobox instead of the "New Products" Infobox  .

*/.

?>.

<! featured_products //>.

<?php.

If(FEATURED_PRODUCTS_DISPLAY == 'true').

{.

 $featured_products_category_id = $new_products_category_id;.

 $cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '"$featured_products_category_id"' limit 1");.

 $cat_name_fetch = tep_db_fetch_array($cat_name_query);.

 $cat_name = $cat_name_fetch['categories_name'];.

 $info_box_contents = array();.

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {.

   $info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation">'TABLE_HEADING_FEATURED_PRODUCTS'</a>');.

 list($usec, $sec) = explode(' ', microtime());.

 srand( (float) $sec + ((float) $usec * 100000) );.

 $mtm= rand();.

   $featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from "TABLE_PRODUCTS" p left join "TABLE_SPECIALS" s on p.products_id = s.products_id left join "TABLE_FEATURED" f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit "MAX_DISPLAY_FEATURED_PRODUCTS);.

 } else {.

   $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));.

   $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from "TABLE_PRODUCTS" p left join "TABLE_SPECIALS" s on p.products_id = s.products_id, "TABLE_PRODUCTS_TO_CATEGORIES" p2c, "TABLE_CATEGORIES" c left join "TABLE_FEATURED" f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '"$featured_products_category_id"' and p.products_status = '1' and f.status = '1' order by rand() DESC limit "MAX_DISPLAY_FEATURED_PRODUCTS);.

 }.

 $row = 0;.

 $col = 0;.

 $num = 0;.

 while ($featured_products = tep_db_fetch_array($featured_products_query)) {.

   $num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); }.

   $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);.

   if($featured_products['specstat']) {.

     $info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' => 'class="smallText" width="33%" valign="top"',.

                                          'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br><s>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))'</s><br><span class="productSpecialPrice">'.

                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))'</span>');.

   } else {.

     $info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' => 'class="smallText" width="33%" valign="top"',.

                                          'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));.

   }    .

   $col ++;.

   if ($col > 2) {.

     $col = 0;.

     $row ++;.

   }.

 }.

 if($num) {.

     .

     new contentBox($info_box_contents);.

 }.

} else // If it's disabled, then include the original New Products box.

{.

  include (DIR_WS_MODULESFILENAME_NEW_PRODUCTS);.

}.

?>.

<! featured_products_eof //>..

Comment #3

OK, so add this anywhere after $featured_products['products_id'] is defined:.

  $bn_text = tep_draw_form('buy_now', tep_href_link(basename(FILENAME_PRODUCT_INFO), tep_get_all_get_params(array('action'))'action=buy_now&products_id='. $featured_products['products_id']), 'POST')tep_draw_input_field('buyqty', '1', 'size=2 maxlength=2')tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle')'</form>';.

This bit:.

Tep_draw_input_field('buyqty', '1', 'size=2 maxlength=2').

Can be changed to this:.

Tep_draw_hidden_field('buyqty', '1').

If you don't want a quantity box.

And then ....

CHANGE.

'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));.

To ....

'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id']))'<br>'$bn_text);.

See if that works out...

Comment #4

It worked...thanks again Acheron..

Something stranged happened...if I have a "specials" product that is featured, the buy now button doesn't show....

DO you have any clue in way this is happenning?..

Comment #5

I have this code :.

$info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' => 'class="smallText" width="33%" valign="top"',.

                                          'text' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'tep_image(DIR_WS_IMAGES$featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=produtos1')'</a><br><a href="'tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='$featured_products['products_id'])'">'$featured_products['products_name']'</a><br>'$currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));.

And would like to a "buy now" button....

THis piece works in "products new".

           <td align="right" valign="middle" class="main"><?php echo '<a href="'tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action'))'action=buy_now&products_id='$products_new['products_id'])'">'tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART)'</a>'; ?></td>.

Could you please help me?..

Comment #6

Haven't even looked at the file but try adding ....

'form' => '<a href="'tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action'))'action=buy_now&products_id='$featured_products['products_id'])'">'tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART)'</a>'.

Backup first, especially since I'm just taking a shot in the dark here...

Comment #7


This question was taken from a support group/message board and re-posted here so others can learn from it.