Jump to content

Product attribute direct link


Recommended Posts

Hi, i hope that someone can help me.

 

Is there a method to get direct link to single product attribute? For example if i have 3 different groups titled "groupA", "groupB", "groupC", product has attributes in all of them and i want to get link to a "groupC" attribute value only. Can it be done simple, by editing tpl file, and making there direct link?

Not like in cart in a main theme, where are all attributes printed under the product name.

 

I'll will be very thankfull for help.

Link to comment
Share on other sites

I mean the link that will print on a set by me place on a site value of chosen by me attribute.

 

For example:

 

productA has a default combination of 3 attributes: cpu:

 

2,1ghz (group id=5), memory: 250Gb (group id=6), layout: modern (group id=7).

 

Cart in a default theme by code "{if isset($product.attributes) && $product.attributes}<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}">{$product.attributes|escape:'htmlall':'UTF-8'}</a>{/if}" will print in cart:

 

Product name

attributes:

Cpu: 2,1ghz,

memory: 250gb,

layout: modern

 

I need to get just single attribute from them. Even if I would directly set group id in a link.

 

It should looks like that:

 

Product name

memory: 250gb

 

Just one atrribute printed, without modyfying a combination. I know groups id's so i need just to get link to a default value of a product attribute for group id=6 for example.

Link to comment
Share on other sites

Heh :)

 

post-312169-0-59673900-1326911441_thumb.jpg

 

This is a view of a standard cart.

 

In description column under the product name, You have printed combination of 3 attributes assigned for this product. It is from ...{$product.attributes|escape:'htmlall':'UTF-8'}... i suppose.

 

I'm asking is it possible to get single links to every of this attributes alone, to place them separately, in a different place in the page. Not like in Cart (on image) binded and displayed together, one by one. I want to find a way to place in one column group "layout", in next column group "memory", in next column group "procesor". And in next row of a table, under group names, should be displayed values of attributes, like "modern", "250gb", "1,80ghz".

 

 

 

post-312169-0-59673900-1326911441_thumb.jpg

post-312169-0-39348200-1326911897_thumb.jpg

Link to comment
Share on other sites

Everything is possible, if you know PHP and Prestashop...

 

You would have to parse the combined string $product.attributes either in the .tpl file, or in the product controller (product controller is the better option).

 

Once you parse it, you could then assign each part to a new variable, which you could then display anywhere you want on the checkout page.

Link to comment
Share on other sites

  • 2 months later...

What do you mean by a direct link?

 

A URL that when opened, will set that attribute as the default selection?

 

Hi Tomerg3

i'd need the exact thing you said..

 

Could it be possible to do that?

Please consider i also purchased the AWPro module.

 

Thanks,

Simone

Link to comment
Share on other sites

  • 11 years later...

so i am in Presta 8 and I try:

$url = $link->getAdminLink('AdminProducts', true, array(
            'route' => 'admin_product_catalog',
            'id' => $productID
        ));

but my link is like /admincatalog/index.php/sell/catalog/products?id=2&token=TOKEN (doesn't work)

but it should be like: /admincatalog/index.php/sell/catalog/products/2?_token=TOKEN (work)

 

where 2 is productID

 

Link to comment
Share on other sites

OK, small small diference made it work, maybe will help someone:

  $url = $link->getAdminLink('AdminProducts', true, ['id_product' => $productID]);

and of course:

 $link = $this->context->link;

and that gives link: /admincatalog/index.php/sell/catalog/products/IDPRODUCT?_token=TOKEN (that work)

Edited by Butch0071 (see edit history)
Link to comment
Share on other sites

On 8/16/2023 at 2:39 PM, Butch0071 said:

so i am in Presta 8 and I try:

$url = $link->getAdminLink('AdminProducts', true, array(
            'route' => 'admin_product_catalog',
            'id' => $productID
        ));

but my link is like /admincatalog/index.php/sell/catalog/products?id=2&token=TOKEN (doesn't work)

but it should be like: /admincatalog/index.php/sell/catalog/products/2?_token=TOKEN (work)

 

where 2 is productID

https://machance-casino-en-ligne.com/

The reason why your first link doesn't work is because the id parameter is not in the correct format. The id parameter should be a number, but in your first link it is a string. 

Edited by Ron873 (see edit history)
Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...