marsisz Posted January 18, 2012 Share Posted January 18, 2012 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 More sharing options...
tomerg3 Posted January 18, 2012 Share Posted January 18, 2012 What do you mean by a direct link? A URL that when opened, will set that attribute as the default selection? Link to comment Share on other sites More sharing options...
marsisz Posted January 18, 2012 Author Share Posted January 18, 2012 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 More sharing options...
tomerg3 Posted January 18, 2012 Share Posted January 18, 2012 I am more confused now than before your last message. Link to comment Share on other sites More sharing options...
marsisz Posted January 18, 2012 Author Share Posted January 18, 2012 Heh 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". Link to comment Share on other sites More sharing options...
tomerg3 Posted January 18, 2012 Share Posted January 18, 2012 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 More sharing options...
marsisz Posted January 19, 2012 Author Share Posted January 19, 2012 thx, that was what i would like to hear I'm a beginner in a Prestashop and in php, so that's why i asked about. I'll try. Txh for help, and trying to reach what's my problem:) Best Regards Tomerg3 Link to comment Share on other sites More sharing options...
reversi Posted April 16, 2012 Share Posted April 16, 2012 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 More sharing options...
Butch0071 Posted August 16, 2023 Share Posted August 16, 2023 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 More sharing options...
Butch0071 Posted August 16, 2023 Share Posted August 16, 2023 (edited) 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 August 16, 2023 by Butch0071 (see edit history) Link to comment Share on other sites More sharing options...
Ron873 Posted August 16, 2023 Share Posted August 16, 2023 (edited) 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 August 25, 2023 by Ron873 (see edit history) Link to comment Share on other sites More sharing options...
Butch0071 Posted August 16, 2023 Share Posted August 16, 2023 thank you, so when I make it int($productID) - it will work? Link to comment Share on other sites More sharing options...
berkaykala Posted February 12 Share Posted February 12 can you help me please The attribute button does not work in 8.1.3. page refreshes, but 8.1.1 works fine. Link to comment Share on other sites More sharing options...
berkaykala Posted February 12 Share Posted February 12 debug log Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now