Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Content Module Development


Recommended Posts

I have a content module that I've developed that I want to add to both my product_info.php and product_listing.php pages.   I have it working nicely on my product_info.php by echo it out using the following code.

<?php echo $oscTemplate->getContent('additional_shipping'); ?>

But I'm struggling trying to figure out how to call it from the product_listing.php.  That page is maining built using a rather large string...

$prod_list_contents .= blah, blah, etc.

and I can't seem to wrap my head around how to go about adding the module call to that string or if it is even possible.  I'm think something like...

$prod_list_contents .= $oscTemplate->getContent('additional_shipping');

but of course that doesn't work.

Any ideas on how I might go about this...I added the module directly to the page to get it to work but I'd really like to figure out how to call the module?

Dan

Link to comment
Share on other sites

Hi Dan

 

I just did a quick test with the wishlist module. I normally use this code to show the add to wishlist button on the product info page.

  <div class="row">
    <?php echo $oscTemplate->getContent('product_info'); ?>
  </div>

so I tried this here inside the product_listing.php just to see if anything would show.

$prod_list_contents .=  $oscTemplate->getContent('product_info');

and it did show the button. Just the code inside that module is not coded for the listing page therefore the button did not work and it multiplied.

1st product, one button. 2nd product 2 buttons, 3rd product, 3 buttons....and so on. Here again module is not coded for listing page.

But it did show which indicates that the $oscTemplate->getContent part does some what work.

I am not an expert when it comes to modules but I would say it does work. Maybe Burt or Raiwa can chime in since those guys are more savvy when it comes to modules.

Link to comment
Share on other sites

Hi Lambros

 

But it did show which indicates that the $oscTemplate->getContent part does some what work.

I am not an expert when it comes to modules but I would say it does work. Maybe Burt or Raiwa can chime in since those guys are more savvy when it comes to modules.

 

Thanks for having a look.  I got pretty much the same result...I could see the code in the source but it didn't want to work at it does on the product_info.php.   When I get some more time I'll have a closer look at the source of both files to see if I can figure out what is actually missing.  For the time being I just took the module contents and posted them within the product_listing.php page and it works the way I want but that isn't how I really want to leave it.

 

As least I now know it's just not me. :lol:

 

Dan

Link to comment
Share on other sites

@@burt

 

Maybe a Hook would have been useful here...

 

Thanks Gary....I seem to have a basic understanding of how content modules work now but have not yet looked at the hook system although I've been wanting to.   Maybe this will make a good test case for me cut my teeth on.

 

Dan

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...