Post by didi13uk » Wed Apr 22, 2020 3:21 am

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

Newbie

Posts

Joined
Mon Jul 29, 2019 10:32 pm

Post by straightlight » 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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by didi13uk » 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?

Newbie

Posts

Joined
Mon Jul 29, 2019 10:32 pm

Post by straightlight » Wed Apr 22, 2020 3:58 am

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 .

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by paulfeakins » 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?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by didi13uk » 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???

Newbie

Posts

Joined
Mon Jul 29, 2019 10:32 pm

Post by straightlight » Thu Apr 23, 2020 2:52 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Bing [Bot], jagall, SohBH and 261 guests