Jump to content

accessing manufacurers wesite


peterp

Recommended Posts

Hi All,

I have a client that is using a derivative of the foundation template and has within his menu items a 'Shop by Brand' and what he wants to happen is when all the brands with their images is displayed after selecting 'Shop by Brands" menu item is selected then the user can select a brand, when this is done then the selected Brands web page is displayed, what he also wants to see happening is when the user exits out of the brands website it will go back to his website.

I think I have seen this somewhere in cubecart but for the life of me I cannot get the standard package of cubecart  ver 6.4.10 to do this. Obvious question is cubecart capalbe of doing this and I have just missed something in the setup or am I kidding myself and will need modifications to achieve this.

Any advice or pointing in the right direction will be appreciated.

Best Regards,

Peterp

 
 
Link to comment
Share on other sites

Some of what you describe might be some of the features of Enhanced Manufacturers:

https://www.cubecart.com/extensions/plugins/enhanced-manufacturers

The description of the features set there is a bit sparse.

But, when using the Advanced Search, one can filter against a manufacturer. When viewing a product, the Specification tab will contain the name of the manufacturer, and will be a hyperlink if one was provided when adding/editing a manufacturer in admin.

That link has a 'target' attribute equal to "_blank" which will open the web page pointed to by the link in a new browser window or tab.

Link to comment
Share on other sites

Hi Brian,

In the standard cubecart when you setup a manufacturer you can input that manufacturers website address would it be possible to associate this URL address with the image that is used in the setup of the sub category which would be the manufacturer under the category of 'Shop by Brand' Then when the user selects a logo of the brand it will use the URL address and load the manufacturers website which when exited goes back to the main website.

I have tried the 'Enhanced manufacturers' extension and have found that it doesn't work and the author will not reply to my emails when I show them that it isn't doing what they say it is doing so not going to use that.

I have attached some screen shots to try and show what I'm trying to achieve hope this helps.

WorkGearSelect-mainpageshowingshopbybrand.png.bd9fa816f4aaca475b1cf32586000375.png

SHOP BY BRANDS -logos.png

Admin Control Panel manufactures.png

Admin Control Panel subcatergories.png

Admin Control Panel parent category setup.png

Link to comment
Share on other sites

I will give this some thought. I assume you have the permission of the various manufacturers to use their logos on your site - maybe you're an authorized distributor with certain benefits?

Where did the "Shop by Brands" come from?

Ok, I see this as a legit category, with child categories.

Edited by bsmither
Link to comment
Share on other sites

The stock behavior of the sub-cat images are links to those categories, as well as the caption (name of the category) of the image shown below the image.

Where would a link that points to the manufacturer's website be shown? An additional link below the child category's name? Co-opt the link being used by the child category's image? (Which this latter choice seems to be what you want.)

With respect to "when the user exits out of the brands website it will go back to his website", that's how browsers usually work - a link calls open a new tab, and when that new tab is closed, the browser returns to showing the calling window/tab. Or is there something wanted that is more involved?

Even though you are making Manufacturers into categories, there is no direct relationship between the two.

Some sort of connection will need to be established that "this category" is associated with "that manufacturer" - which, obviously, won't be applicable to every category.

Each category has its "Description". A link (target="_blank") to the manufacturer's website can be included here. What is your opinion on this idea?

Link to comment
Share on other sites

Hi Brian,

Where would a link that points to the manufacturer's website be shown? An additional link below the child category's name? Co-opt the link being used by the child category's image? (Which this latter choice seems to be what you want.)  YES this seems to work for me as it will tell the user whether the category is linked to a web site or not, it could also be that when the logo is clicked it will go to the link site if there is one and in this case no additional link description would be required, either way works for me.

The client is aware that each manufacturer could have a website but is not necessary

All of the other categories will be individual and are not expected to have any website links

With respect to "when the user exits out of the brands website it will go back to his website", that's how browsers usually work - a link calls open a new tab, and when that new tab is closed, the browser returns to showing the calling window/tab.

Understand that when a user clicks on the website it will revert back to the calling website that's great there is no other requirement

It all sounds good how do we achieve this

 

Best Regards,

Peterp

 

Link to comment
Share on other sites

Here is a set of edits that should get you a solution.

The admin skin template categories.index.php:

Find:

    <div><label for="seo_path">{$LANG.settings.seo_path} *</label><span><input type="text" name="seo_path" id="seo_path" class="textbox" value="{$CATEGORY.seo_path}"></span></div>
    <div><label for="seo_meta_description">{$LANG.settings.seo_meta_description}</label><span><textarea name="cat[seo_meta_description]" id="seo_meta_description" class="textbox">{$CATEGORY.seo_meta_description}</textarea></span></div>

After that, add:

    <div><label for="seo_meta_keywords">{$LANG.settings.seo_meta_keywords} **</label><span><textarea name="cat[seo_meta_keywords]" id="seo_meta_keywords" class="textbox">{$CATEGORY.seo_meta_keywords}</textarea></span></div>

Find:

  <p>* {$LANG.settings.seo_path_auto}</p>

After that, add:

  <p>** Use a code from this list to associate a manufacturer with this category.</p>
  <table>
    <thead>
      <tr>
        <td>Code</td>
        <td>{$LANG.catalogue.title_manufacturer}</td>
      </tr>
    </thead>
    <tbody>
{foreach from=$MANUFACTURERS item=manufacturer}
      <tr>
        <td><strong>MANU:{$manufacturer.id}</strong></td>
        <td>{$manufacturer.name}</td>
      </tr>
{foreachelse}
      <tr>
        <td colspan="2" align="center"><strong>{$LANG.form.none}</strong></td>
      </tr>
{/foreach}
    </tbody>
  </table>

The admin source file categories.index.inc.php:

Near line 413, find:

        $GLOBALS['smarty']->assign('SELECT_CATEGORIES', $select_categories);
        $GLOBALS['smarty']->assign('MODE_ADDEDIT', true);
        foreach ($GLOBALS['hooks']->load('admin.category.addedit_display') as $hook) {
            include $hook;
        }

After that, add:

        $manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', false, false, array('name' => 'ASC'));
        $GLOBALS['smarty']->assign('MANUFACTURERS', $manufacturers);

In the Admin side, we are re-adding and using a setting in Add/Edit Categories (that had been removed in a much earlier version). The corresponding database table column should still be available - the 'seo_meta_keywords'. Here, the admin would enter, as a keyword, a Code that represents the manufacturer.

On the Store side, there will be a search pattern looking for this Code, and that will fetch the manufacturer details to be used on the View Category page for the sub-cats, if appropriate.

The class file catalogue.class.php:

Find the public function displaySubCategory()

In that function, find:

                        $cat['url'] = $GLOBALS['seo']->buildURL('cat', $cat['cat_id'], '&');
                        $cat['products_number'] = $products;

After that, add:

                        preg_match('/MANU:([\d]+)/', $cat['seo_meta_keywords'], $manu_match);
                        $cat['manufacturer_tag'] = $this->getManufacturer($manu_match[1] ?? false, true);
                        $cat['manufacturer_name'] = strip_tags($this->getManufacturer($manu_match[1] ?? false));

Find the public function getManufacturer()

Change:

    public function getManufacturer($manufacturer_id)

To:

    public function getManufacturer($manufacturer_id, $placeholder = false)

Change:

                return '<a href="'.$manufacturers[0]['URL'].'" target="_blank">'.$manufacturers[0]['name'].'</a>';

To:

                return '<a href="'.$manufacturers[0]['URL'].'" target="_blank">'.($placeholder ? '%s' : $manufacturers[0]['name']).'</a>';

The Foundation skin template content.category.php:

Find:

{if isset($SUBCATS) && $SUBCATS}
<ul class="medium-block-grid-6 text-center small-block-grid-3" data-equalizer>
   {foreach from=$SUBCATS item=subcat}
   <li data-equalizer-watch>
      <a href="{$subcat.url}" title="{$subcat.cat_name}">
        <img class="th" src="{$subcat.cat_image}" alt="{if isset($subcat.image_tags.alt)}{$subcat.image_tags.alt}{else}{$subcat.cat_name}{/if}"{if isset($subcat.image_tags.title)} title="{$subcat.image_tags.title}"{/if}>
      </a>
      <br>
      <a href="{$subcat.url}" title="{$subcat.cat_name}"><small>{$subcat.cat_name}</small></a>
   </li>
   {/foreach}
</ul>
{/if}

Change to:

{if isset($SUBCATS) && $SUBCATS}
<ul class="medium-block-grid-6 text-center small-block-grid-3" data-equalizer>
   {foreach from=$SUBCATS item=subcat}
{capture "subcatImage"}<img class="th" src="{$subcat.cat_image}" alt="{if isset($subcat.image_tags.alt)}{$subcat.image_tags.alt}{else}{$subcat.cat_name}{/if}"{if isset($subcat.image_tags.title)} title="{$subcat.image_tags.title}"{/if}>{/capture}
   <li data-equalizer-watch>
{if $subcat.manufacturer_tag}{$subcat.manufacturer_tag|replace:"%s":$smarty.capture.subcatImage}
{else}
        <a href="{$subcat.url}" title="{$subcat.cat_name}">{$smarty.capture.subcatImage}
        </a>
{/if}   <br>
{if $subcat.manufacturer_tag}{$subcat.manufacturer_tag|replace:"%s":"<small>{$subcat.manufacturer_name}</small>"}
{else}
      <a href="{$subcat.url}" title="{$subcat.cat_name}"><small>{$subcat.cat_name}</small></a>
{/if}
   </li>
   {/foreach}
</ul>
{/if}

However: Now that the sub-cat image and caption are linked to the manufacturer's web site, the customer must intuit that the only way to get to a sub-cat is via the Navigation bar. Hopefully, that won't be too non-obvious.

Link to comment
Share on other sites

Hi Brian,

Sorry about the delay in getting back to you but I have been inundated with work. Anyway I have made all of the changes and all looks good thanks again for your help it is extremely appreciated.

Best Regards,

Peterp

 

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
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...