cancel
Showing results for 
Search instead for 
Did you mean: 

External Anchor links not working

External Anchor links not working

It sure feels like this ought to be easy, but it isn't working.  I need an external link to the point on a category page right above where the products are listed.  In the category html, I've added:

 

<a name="productsbelow"><hr></a>

 

So the external link should be http://www.zephyr-tec.com/speech-recognition/dragon-medical-practice-edition.html#productsbelow

 

The page loads, but pops up this box and then goes to the top of the page. [The overall goal here is a hyperlink from an e-mail that would go directly to the product list for that category.]

 

I'm (far from) a Megento expert, but most other standard HTML stuff works fine when editing Magento pages.  What's going wrong here?  Is this a Magento setting I need to tweak somewhere?

 

 

2 REPLIES

Re: External Anchor links not working

Hello @JohnCollier

There 3 things that confuse me here and can cause the issue you get:

1. As far as I know, such relative links can work within a site only, i.e.they should be internal but not external.

2. I woudn't insert a line (<hr>) within a link

3. You code is missing href=

 

So I would go for something like:

<a href="your full URL">link</a>

 

Was my answer helpful? You can accept it as a solution.
200+ professional extensions for M1 & M2 with free lifetime updates!

Re: External Anchor links not working

Here's your solution. Refer it as an example.

 

Let me explain you in detail. This solution would work definately for you.


1. Go to your magento eCommerce admin panel and follow the path: Catalog >> Attributes >> Manage Attributes.

2. Add one attribute, you would land to Attribute Information page.

3. In Properties tab, Under Frontend Properties section there would be "Used in Product Listing" field select it as Yes. Save the configuration.

4. Go to Catalog >>Attributes >> Manage Attributes Sets, Select created attribute which you need to show under the attribute section on front end.

For E.g: Select "Default" Set Name. Drag attribute (Attribute which you have created) which would be shown under "Unassigned Attributes" section to "Groups" section under General folder.

5. Further, Goto Catalog >> Manage Products. Edit any one of your products and view the general section and you can find your created attribute here. Now, add your URL (E.g: https://www.google.co.in) into created attribute's field. Save configuration.

Now, open your phtml file which would be placed at: app\design\frontend\mypackage\mytheme\template\catalog\product\list.phtml and edit your code.

Your Code:

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></ span> </ button> 


Replace the below code into Grid Mode Code: [ Around Line no: 153 ]

<button type="button" title="<?php echo $this->__('Buy Now') ?>" class="button btn-cart" onclick="setLocation('<?php echo $_helper->productAttribute($_product, $_product->getLinkEx(), 'link_ex') ?>')"><span><span><?php echo $this->__('Buy Now') ?></span></span></button>

Let me explain you the added code:

<?php echo $_helper->productAttribute($_product, $_product->getLinkEx(), 'link_ex') ?>

This code will get value of your created attribute.

getLinkEx() : This is your created attribute code (So make sure you enter that particulat attribute code which you have created)

Hope this would help you!

Query solved? Accept as Solution.Thanks
Eric Baily