Page 1 of 1

Link to a product in attribute section

Posted: Wed Apr 22, 2020 3:21 am
by didi13uk
Hello,
Where can I edit the code so I can add a link in the attribute of a product (e.g. for "product X", I can tell in the Specifications that the compatible product is "product Y", which is click-able and sent you to "product Y" page)
Thank you

Re: Link to a product in attribute section

Posted: Wed Apr 22, 2020 3:27 am
by straightlight
You could use the Attributes List extension: https://www.opencart.com/index.php?rout ... n_id=33794 or a filtering attribute search extension for your store. This way, even search engines could track your attributes in more generic ways rather than knowing which products specifically would be relative with each attributes.

Re: Link to a product in attribute section

Posted: Wed Apr 22, 2020 3:52 am
by didi13uk
straightlight wrote:
Wed Apr 22, 2020 3:27 am
You could use the Attributes List extension: https://www.opencart.com/index.php?rout ... n_id=33794 or a filtering attribute search extension for your store. This way, even search engines could track your attributes in more generic ways rather than knowing which products specifically would be relative with each attributes.
Any chance to edit the code though?

Re: Link to a product in attribute section

Posted: Wed Apr 22, 2020 3:58 am
by straightlight
didi13uk wrote:
Wed Apr 22, 2020 3:52 am
straightlight wrote:
Wed Apr 22, 2020 3:27 am
You could use the Attributes List extension: https://www.opencart.com/index.php?rout ... n_id=33794 or a filtering attribute search extension for your store. This way, even search engines could track your attributes in more generic ways rather than knowing which products specifically would be relative with each attributes.
Any chance to edit the code though?
In your catalog/view/theme/<your_theme>/template/product/product.twig file. The attributes are already coded in there. Take note that these attributes works by multiple results for the same products. If you're looking to load a specific attribute, you'd require an extension from the Marketplace to accomplish this. Otherwise, you could build an after event file, OCMod or VQMod to add your content into your $data array in order to load specific attribute names. AFAIK, from the Marketplace, there are extensions that allows to load a drop-down menu to redirect to other product relative pages based on their product options. A similar way could either be done or be used with the attributes.

See this extension for the product options: https://www.opencart.com/index.php?rout ... n_id=27832 .

Re: Link to a product in attribute section

Posted: Wed Apr 22, 2020 6:39 pm
by paulfeakins
didi13uk wrote:
Wed Apr 22, 2020 3:52 am
Any chance to edit the code though?
Bad idea to start filling attributes with hard-coded links. If your domain name changes, or your product URLs change you'll have created a problem.

You could use related products instead?

Re: Link to a product in attribute section

Posted: Thu Apr 23, 2020 2:45 am
by didi13uk
paulfeakins wrote:
Wed Apr 22, 2020 6:39 pm
didi13uk wrote:
Wed Apr 22, 2020 3:52 am
Any chance to edit the code though?
Bad idea to start filling attributes with hard-coded links. If your domain name changes, or your product URLs change you'll have created a problem.

You could use related products instead?
Actually I think this is what I wanted to do, products related with the original product.. How can I do this???

Re: Link to a product in attribute section

Posted: Thu Apr 23, 2020 2:52 am
by straightlight
didi13uk wrote:
Thu Apr 23, 2020 2:45 am
paulfeakins wrote:
Wed Apr 22, 2020 6:39 pm
didi13uk wrote:
Wed Apr 22, 2020 3:52 am
Any chance to edit the code though?
Bad idea to start filling attributes with hard-coded links. If your domain name changes, or your product URLs change you'll have created a problem.

You could use related products instead?
Actually I think this is what I wanted to do, products related with the original product.. How can I do this???
The related products are already built-in the product page. You could use the related products from your OC admin - > catalog - > products page and see the results from your catalog page under the product page.