Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display Manufacturer Name ( Link To All Products ) On Product_Info.php


Recommended Posts

Hi All,

Has anyone developed a 2.3.4 BS Module for: Displaying The Manufacturer's Name ( Link To All Products ) On The Product_Info.php Page of the website... Modules > Content Modules > Product Info > Manufacturer

Ideally it would Display the Manufacturer's Name and be Hyperlink to All of the Products by this Same Manufacturer...

Taking the user to... for example: /index.php?manufacturers_id=2

I did not see an add-on available, but wanted to ask the community for help first!

Thank You All!

Capture.JPG

Link to comment
Share on other sites

Yes, there's a box module in the standard download - turn it on!

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

manufacturer_info.jpg

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Dear @BrockleyJohn,  @Bobber

It is correct that there is that box.

But I think the idea that the idea of  @Bobberis to have it as a Modules> Content Modules> Product Info instead of a box.

It would be a great addon if someone could do it.

Kiss

Valqui

 

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

On 5/27/2018 at 2:05 AM, BrockleyJohn said:

Yes, there's a box module in the standard download - turn it on!

@BrockleyJohn I agree this box module is nice, but I want to have a module like this: Modules > Content Modules > Product Info > Manufacturer

Reason being: I think it would be more useful to the customer if manufacturer's name ( with a hyperlink to all of that manufacturer's other products ) was next to the model and gtin in the product info...

With mobile viewing and buying via eCommerce becoming much more important than they were before little details like this seem to be a big deal.

Link to comment
Share on other sites

2 hours ago, Bobber said:

@BrockleyJohn I agree this box module is nice, but I want to have a module like this: Modules > Content Modules > Product Info > Manufacturer

Reason being: I think it would be more useful to the customer if manufacturer's name ( with a hyperlink to all of that manufacturer's other products ) was next to the model and gtin in the product info...

With mobile viewing and buying via eCommerce becoming much more important than they were before little details like this seem to be a big deal.

If you want an easy way to make your own module, you need a bit of @wHiTeHaT's magic: https://oscompose.com/

Create a product info content module and crib the code from the box for the execute function.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

:sad: did not find it that simple as the manufacturers_name is not in the product_info.php file. It can be done but will require changes to core which is not good. Or have I missed somthing?

image.thumb.png.ee3e4128c243238f09822792e2127cb7.png

 

 

Link to comment
Share on other sites

@JcMagpie it doesn't need any changes to product_info.php

It needs a content module in the product_info directory. The existing code will load it if it is installed and enabled.

...though I don't off-hand remember how much of the page is modularised in "frozen". Earlier versions of Edge do need some clever stuff to get content high in the page.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

6 minutes ago, BrockleyJohn said:

@JcMagpie it doesn't need any changes to product_info.php

It needs a content module in the product_info directory. The existing code will load it if it is installed and enabled.

:wacko: I must be doing something wrong I have it working with no core changes to show manufactures_id works fine, But when I use manufactures_name nothing shows at all. Oh I just made copy of the product_name module and changed code to show manufacurers.

 

Link to comment
Share on other sites

1 minute ago, JcMagpie said:

:wacko: I must be doing something wrong I have it working with no core changes to show manufactures_id works fine, But when I use manufactures_name nothing shows at all.

post your execute function

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

This works fine I get the id showing with no change to core code

 const MODULE_CONTENT_PI_MANID_DISPLAY_MANUFACTURERS_ID = 'Manufacturer ID: %s';

Using same module changed for name give blank space on page, somethig is in the page as the layouut changes but no visable man name.

const MODULE_CONTENT_PI_MNAME_DISPLAY_MANUFACTURERS_NAME = 'Manufacturer: %s';

 

 

Link to comment
Share on other sites

again this works for id but not for name

 class cm_pi_mname {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_PI_MNAME_TITLE;
      $this->description = MODULE_CONTENT_PI_MNAME_DESCRIPTION;
      $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>';

      if ( defined('MODULE_CONTENT_PI_MNAME_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_PI_MNAME_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_PI_MNAME_STATUS == 'True');
      }
    }

    function execute() {
      global $oscTemplate, $product_info;
      
      $content_width = (int)MODULE_CONTENT_PI_MANID_CONTENT_WIDTH;
      
      $manufacturers_name = $product_info['manufacturers_name'];
      
      ob_start();
      include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
      $template = ob_get_clean();

      $oscTemplate->addContent($template, $this->group);
    }

 

 

Link to comment
Share on other sites

Changing this one line in product_info.php  and name works fine,

 

//$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_gtin from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

New,
    $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "' and m.manufacturers_id = p.manufacturers_id");

 

Link to comment
Share on other sites

The easiest way to get what he asked is to start with a copy the execute function from the box module which does exactly what's wanted plus some other stuff:

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

      if (isset($_GET['products_id'])) {
        $manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$_GET['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
        if (tep_db_num_rows($manufacturer_query)) {
          $manufacturer = tep_db_fetch_array($manufacturer_query);

          $manufacturer_info_string = NULL;
          if (tep_not_null($manufacturer['manufacturers_image'])) $manufacturer_info_string .= '<div>' . tep_image('images/' . $manufacturer['manufacturers_image'], htmlspecialchars($manufacturer['manufacturers_name'])) . '</div>';
          if (tep_not_null($manufacturer['manufacturers_url'])) $manufacturer_info_string .= '<div class="text-center"><a href="' . tep_href_link('redirect.php', 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank">' . sprintf(MODULE_BOXES_MANUFACTURER_INFO_BOX_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></div>';

          ob_start();
          include('includes/modules/boxes/templates/manufacturer_info.php');
          $data = ob_get_clean();
          
          $oscTemplate->addBlock($data, $this->group);
        }
      }
    }

Changing the query in the core page is, of course, more efficient though, but it should be a left join in case there isn't a manufacturer.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Please be kind I'm not a a coder! My plan was to simply offer a new product_info.php and they can backup the original ( quick and easy sorry) I will give your method a go in the morning. Thanks for the help.

 

Link to comment
Share on other sites

Not looking to take any crumbs from anyone, sorry you feel that way Gary. I am just getting to know the code and the best way to do that is to use it. My addons for what they are worth are just simple stuff which anyone with a bit of time could produce.

Thank you John and wHiTeHaT every bit helps. Oh and thanks for the https://oscompose.com/     Made life much simpler, getting on slowly but I’m in no rush. You can see my

feeble efforts so far, Still a few issues to sort out.

Thanks for all the help.

Zahid

 

image.thumb.png.5c7ec82e5a8a5a6abb1b2339e6704c38.png

 

Link to comment
Share on other sites

Ok almost done try it out on the test site and see if you have any issues. Just the modular page layout to sort out. Proving a bit tricky to get it to line up so many interactions with other stuff on the page. Oh and no need to worry about code! nothing new in it at all. All code is existing code. John was right simply took function from box and plonked it into new Module made using wHiTeHaT website tool.:thumbsup: was very easy to use. Thanks.

https://tbyb.co.uk

image.thumb.png.d6be6229cd5a8d23c4e6ad7c96edff83.png

 

Link to comment
Share on other sites

Dear @JcMagpie again thank you very much for the greats addons you make and the availability of always helping. 

I wish everyone had the same attitude as yours.

Just try your test site, and you can select manufacturers, but when you select one manufacturer its redirects you to the shopping_cart.php page and give the following messages:

Matrox G400 32MB has been added to your Cart
Your Shopping Cart is empty!

Best regards

Valqui

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

4 hours ago, valquiria23 said:

Dear @JcMagpie again thank you very much for the greats addons you make and the availability of always helping. 

I wish everyone had the same attitude as yours.

Just try your test site, and you can select manufacturers, but when you select one manufacturer its redirects you to the shopping_cart.php page and give the following messages:

Matrox G400 32MB has been added to your Cart
Your Shopping Cart is empty!

Best regards

Valqui

Ok you can download and try. Thank you to both BrockleyJohn and wHiTeHaT your input helped get this done much quicker.

John as you said the function from the box worked fine. The software builder saved a lot time as well thanks.

 

image.png.abae7c1c6c6cb73c13e42238a7870a1b.png

 

 

Link to comment
Share on other sites

Dear Zahid @JcMagpie, Again thank you very much for your help.

Just install the addon and its work. 

But after the installation I receive this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/25/14014725/html/XXX/catalog/includes/languages/espanol/modules/content/product_info/cm_manufacturers_name.php:1) in /home/content/25/14014725/html/XXX/catalog/admin/includes/functions/general.php on line 38

Best regards.

Valqui

 

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...