M
M
madc0de2019-02-07 15:09:54
opencart
madc0de, 2019-02-07 15:09:54

How to make a separate link for each product option in opencart?

Good evening!
How can I make a separate link to each opencart option?
In fact, 1 product will have several entry points + I will make the link change immediately in the line. But what about opencart routing? I don't understand how it works
Example: a person enters the product card and selects a red T-shirt, the link in the address bar changes. But also if you directly copy and follow the link, the product with the selected option will open.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2019-02-07
@zoozag

The essence of routing is something like this:
- url is divided by /
- matches are searched in the url_alias table
- if matches are found - query is divided by =
- based on this, it is checked whether the page belongs to a product, category, manufacturer or article. Extract id and route from this or send it to query.
You need to add logic to the place where the routing understood that the page belongs to the product (this is if
you have seo_url):

if (isset($this->request->get['product_id'])) {
  $this->request->get['route'] = 'product/product';

If seo_pro, it will be a little more difficult, but the essence is about the same

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question