Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Star Products v1.3


jacobr

Recommended Posts

I just installed Star Products v1.3 and have it up and running for the most part. My problem is that it inserts a bunch of blank table code that is creating a huge gap between where Star Products is installed and where the TEXT_MAIN is. (I modified it to go above instead of below).

 

Everything else looks perfect with this contrib (well the Admin kinda sucks, but ok) - I just need to get rid of all of those extra table rows, etc...

 

Can anybody help me get rid of that code? I'm at a loss...

 

Thanks for any help!

 

Jacob

 

 

Here is my code for includes/modules/star_products.php

 

------- start star_products.php ----------

<?php
//REMOVE THIS LINES IF YOU DON'T WANT TO SHOW THE HEADER
 $header_star_product = array();
 $header_star_product[] = array('align' => 'center', 'text' => sprintf(STAR_TITLE));
 new contentBoxHeading($header_star_product);
//END OF -REMOVE THIS LINES IF YOU DON'T WANT TO SHOW THE HEADER-

 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="5%" width="85%" class="star-product-title">' . $star_products['products_name'] . ' - ' . $currencies->display_price($star_products['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '      ' . ' <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>
        <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'], 105, 100) . '</a></td>
      </tr>
      <tr>
        <td height="40%" width="85%" class="star-product">'. $star_products["products_description"] . '   ' . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . STAR_READ_MORE . '</a></td>
       </tr>');
new contentBox($star_products);
}
?>

-------------- end star_products.php ---------------

 

Here is the source code from my 'index' page where star products is:

 

-------------- start source code ---------------------

<!-- added Star Product -->
  <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td height="14" class="infoBoxHeading"><img src="images/pixel_trans.gif" border="0" alt=""></td>
   <td height="14" class="infoBoxHeading" width="100%">Featured Product</td>

   <td height="14" class="infoBoxHeading"><img src="images/pixel_trans.gif" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="4" class="infoBoxContents">
 <tr width="100%" valign="top">
   <td align="center" width="100%" valign="top"><tr>
              <td height="5%" width="85%" class="star-product-title">ABC - $399.00       <a href="http://ABCDEF.com/ocd/index.php?action=buy_now&products_id=30"><img src="includes/languages/english/images/buttons/button_buy_now.gif" border="0" alt="Add to Cart" title=" Add to Cart "></a></td>

        <td align="right"  height="100%" width="15%" rowspan="2"><a href="http://ABCDEF.com/ocd/popup_image.php?pID=30" 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=105, height=100').focus(); return false;"><img src="images/ABC.jpg" border="0" alt="ABC" title=" ABC " width="105" height="100"></a></td>
      </tr>
      <tr>
        <td height="40%" width="85%" class="star-product">This product is great.   <a href="http://ABCDEF.com/ocd/product_info.php?products_id=30">Read more...</a></td>
       </tr></td>
 </tr>
 <tr>

   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>

   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>

   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>
   <td></td>
 </tr>
 <tr>

   <td></td>
 </tr>
</table>
</td>
 </tr>
</table>
</td>
  </tr>
  <!-- end Star Product addon -->

Link to comment
Share on other sites

Hello.

Firstly thanks for the bug report :-)

 

Tomorrow I'll update the contribution with the fix.

 

Here is the changes:

 

Open star_product.php

 

Search this line:

new contentBox($star_products);

 

Replace with this:

 

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...