Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What is the best why to show particular boxes module only on the home page in column_left ?


bruyndoncx

Recommended Posts

Posted

I want the manufacturers box module only shown on the home page.

 

I already have the customization that I can choose which pages a module should show up on

but index.php is the same for the home page as the categories listing.

 

I could code the manufacturers box to not return anything if not on the home page, but I feel it's kind of a dirty solution and am wondering if there isn't a more elegant way without having to add that logic to the getData function in the box module.

 

Can you think of other more elegant coding solutions ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

@@bruyndoncx - I don't think there is a more elegant way than some dirty code in the box file.

 

function execute() {
  global $SID, $oscTemplate, $category_depth;
  if ((USE_CACHE == 'true') && empty($SID)) {
    $output = tep_cache_manufacturers_box();
  } else {
    $output = $this->getData();
  }
  switch ($category_depth) {
    case 'top':
    $show_man = true;
    break;
    case 'products':
    case 'nested':
    $show_man = false;
    break;
  }

  if ($show_man === true) $oscTemplate->addBlock($output, $this->group);
   }

Posted

Hi Carine, could something like this be of any help?

 

<?php
if ($current_page == FILENAME_DEFAULT) {
include(DIR_WS_BOXES . 'manufacturers.php');
}
?>

 

Sara

That is how I had it in 2.2, I'm trying to refactor my code to follow the boxes modules coding scheme

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

Try to download the login_box for 2.3 contribution, it has a pretty good example of coding an array of pages to use for triggering where to display or not.

Yes, that is an example of how to make a particular php page specific (hardcoded in the module)

I already have a configurable way of doing this through this other contribution, but I forgot how it is called

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

@@bruyndoncx - I don't think there is a more elegant way than some dirty code in the box file.

 

function execute() {
 global $SID, $oscTemplate, $category_depth;
 if ((USE_CACHE == 'true') && empty($SID)) {
 $output = tep_cache_manufacturers_box();
 } else {
 $output = $this->getData();
 }
 switch ($category_depth) {
 case 'top':
 $show_man = true;
 break;
 case 'products':
 case 'nested':
 $show_man = false;
 break;
 }

 if ($show_man === true) $oscTemplate->addBlock($output, $this->group);
}

It looks like that is the way to go, just a little question, as the manufacturers box is the same always, why do I care about the $SID, and when exactly would I really need to care about $SID ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted

Have you tryed

<?php
$page= htmlentities($_SERVER['PHP_SELF']);
if ($page == '/index.php'){
include(DIR_WS_BOXES . 'manufacturers.php')
}
?>

Always backup your files! You will be glad you did

My add-ons :

SSPP Seperate Shipping Per Product v2.5| Support
Gift vouchers for SPPC 4.22 v2.1 | Support |
Catalog Infobox v1.0 | Sorry no support for Catalog Infobox |
HTML Mail v2.0 | Support |




Upcoming Add ons:

Addon Manager |
Separate Pricing Per Product Qty |
Coupon Populate |
EZ-PDF Catalog

Archived

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

×
×
  • Create New...