How to get a direct link to a specific product?


Should be mentioned that Triablo doesn't have a product page (single, independent page), each product is opened in a popup. So we'll try to do the following: 'On page load, reading the parameters from the URL, getting the ID of the product, triggering the ´showProductItem´ once we have the ID of the product'.

All that's described before, can be achieved by following these steps:

 

1. Open the 'js/components/basicBind.js'.
2. Go to the 'init' function - line 14
3. Before it add a new function called 'getParameterByName', and paste inside it the following code.

4. Inside the 'init' function you should add few lines of code too, just before the 'this.bindActions()' call.

5. Finally, if you've done it correctly you should have something similar to this screenshot.

 

Notes:
1. Please don't forget to put this little comma here.
2. Please make sure that inside your HTML file, at the end of the file you've included the script.js instead of script.min.js.

 

Now the product modal will be opened once you have entered the right id inside your URL.
Ex: http://exemple.com/index.html?id=c13

 

Where 'c13' is the ID of your product. You can find the ID of a specific product by inspecting the product on your page with the Developer Tools.

 

Here's an example:

1. Inspect the 'details icon' as shown in the screenshot.
2. On the 'data-target' you can find the ID of the product.


Last update:
2016-05-12 20:41
Author:
Vlad Sargu
Revision:
1.1
Average rating:0 (0 Votes)