Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Another columns left question


warrenerjm

Recommended Posts

HI

 

I have searched but not found the answer, even though it is a new thing for v2.3.1 & confused lots of newbies/non programmers.

 

I undestand the boxes can be set true or false through admin & these boxes are now in catalog/includes/modules/boxes.

 

What I can't get my head around is where all these boxes are called for on each page. i.e. not all boxes show on all the pages.

 

I have looked at catalog/index.php, product_info.php, & bm_whats_new. (for my example)

 

I want the Whats New box NOT to appear in the products page.

 

Can you help explain to me & others how the new code works to help us understand the new column left & right.

 

Thanks

Link to comment
Share on other sites

Look at bm_product_notifications.php as an example... You need to put the 'if (isset($HTTP_GET_VARS['products_id'])) {' and the closing '}' (of course), in function execute().

Just like in bm_product_notifications.php, surround the code in function execute with the if statement... You would want to change it to 'if (!isset($HTTP_GET_VARS['products_id'])) {' , which his just like what is used in bm_best_sellers.php actually.....heheh

Link to comment
Share on other sites

try [catalog}/includes/column_right.php or [catalog}/includes/column_left.php

 

Dennis

osCPal.com

 

tHE op did say they has 2.3.1, so why oh why give infomation regarding an earlier version. I am fully aware that you are new to this, but please be sure to give the correct info before posting. People get confused between the two versions as it is.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

tHE op did say they has 2.3.1, so why oh why give infomation regarding an earlier version. I am fully aware that you are new to this, but please be sure to give the correct info before posting. People get confused between the two versions as it is.

 

ok thanks for pointing that out

 

i am here to help, but also here to learn more

 

Dennis

Link to comment
Share on other sites

Look at bm_product_notifications.php as an example... You need to put the 'if (isset($HTTP_GET_VARS['products_id'])) {' and the closing '}' (of course), in function execute().

Just like in bm_product_notifications.php, surround the code in function execute with the if statement... You would want to change it to 'if (!isset($HTTP_GET_VARS['products_id'])) {' , which his just like what is used in bm_best_sellers.php actually.....heheh

Thanks Mark

 

I put

if (!isset($HTTP_GET_VARS['products_id'])) {

into the bm_whats_new and also

if (isset($HTTP_GET_VARS['products_id'])) {

 

First one still showed the Whats New in all pages & the second made the Whats New box dissappear completely on all pages?

 

This is my code i.e. placement of above code.

 

    function execute() {
     global $currencies, $oscTemplate;

if (!isset($HTTP_GET_VARS['products_id'])) {
     if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
       $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
       $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

       if (tep_not_null($random_product['specials_new_products_price'])) {
         $whats_new_price = '<del>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br />';
         $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
       } else {
         $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
       }

       $data = '<div class="ui-widget infoBoxContainer">' .
               '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></div>' .
               '  <div class="ui-widget-content infoBoxContents" style="text-align: center;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br />' . $whats_new_price . '</div>' .
               '</div>';

       $oscTemplate->addBlock($data, $this->group);
   	}
     }
   }

 

I put it in the same place as the bm_product_notifications.php (btw my code in bm_product_notifications.php didn't have the ! before isset?)

 

I looked at the bm_specials.php which doesn't show the specials box on the product_info page & it has the ! before isset so it should work with the whats_new too????

 

    function execute() {
     global $HTTP_GET_VARS, $languages_id, $currencies, $oscTemplate;

     if (!isset($HTTP_GET_VARS['products_id'])) {
       if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
         $data = '<div class="ui-widget infoBoxContainer">' .
                 '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SPECIALS) . '">' . MODULE_BOXES_SPECIALS_BOX_TITLE . '</a></div>' .
                 '  <div class="ui-widget-content infoBoxContents" style="text-align: center;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br /><del>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br /><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span></div>' .
                 '</div>';

         $oscTemplate->addBlock($data, $this->group);
       }
     }
   }

 

Thank you for your help. Can you see what I have done wrong please? :blink:

 

I WILL get these little boxes sorted!! :lol:

Link to comment
Share on other sites

it needs to have the ! in it... it should be....

   function execute() {
     global $currencies, $oscTemplate;

    if (!isset($HTTP_GET_VARS['products_id'])) {
     if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
       $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
       $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

       if (tep_not_null($random_product['specials_new_products_price'])) {
         $whats_new_price = '<del>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</del><br />';
         $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
       } else {
         $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
       }

       $data = '<div class="ui-widget infoBoxContainer">' .
               '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' . MODULE_BOXES_WHATS_NEW_BOX_TITLE . '</a></div>' .
               '  <div class="ui-widget-content infoBoxContents" style="text-align: center;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br />' . $whats_new_price . '</div>' .
               '</div>';

       $oscTemplate->addBlock($data, $this->group);
     }
    } 
   }

 

sorry for the confusion.. :)

Link to comment
Share on other sites

First lets see what the "!" mean

if (!isset($HTTP_GET_VARS['products_id'])) {// if products_id IS NOT present

if (isset($HTTP_GET_VARS['products_id'])) {// if products_id IS present

So you can decide what to use.

 

Only thing missing from the above post is, to make the $HTTP_GET_VARS "available" to the function and this you do by adding it to the "globals", so you change this

global $currencies, $oscTemplate;

into this

global $HTTP_GET_VARS, $currencies, $oscTemplate;

Link to comment
Share on other sites

First lets see what the "!" mean

if (!isset($HTTP_GET_VARS['products_id'])) {// if products_id IS NOT present

if (isset($HTTP_GET_VARS['products_id'])) {// if products_id IS present

So you can decide what to use.

 

Only thing missing from the above post is, to make the $HTTP_GET_VARS "available" to the function and this you do by adding it to the "globals", so you change this

global $currencies, $oscTemplate;

into this

global $HTTP_GET_VARS, $currencies, $oscTemplate;

THANK YOU George :D

 

I got confused by the fact that both the specials & best sellers boxes didn't appear on the product page & they had different codes. The Best sellers code must be slightly different or it was becasue it didn't contain any sold items, although I thought I did choose the right category?

 

An explainantion of what a code means helps people to understand what to do. If I see a global do I need to consider this line if adding or amending code within? Not sure what the global does?

 

Now back to the Best Sellers box. Hopefully this has helped me a little more. ;)

 

:thumbsup: thanks

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...