Jump to content

Products - Image click redirect to link


Recommended Posts

Hello Prestashop addicts ;)

 

Prestashop forums and staff is starting to die...

But i still like it more than any other ecommerce

 

to the point...

 

I wanna make a simple website with links to my main website.

 

Website: http://e-dil.gr/converseallstargr/prestashop

 

But i want to click on the product image or to "more" and redirects automatically to link.

 

I made it with a button inside the products (catalog mode) but still im not satisfied.

 

Any ideas from experts ? :)

 

 

Link to comment
Share on other sites

On my website, I used the reference code to generate a "Buy" link to redirect to the PrestaShop Addons pages. You could do something similar to that, though you can't enter a full URL in the reference field. You may need to find another unused field or create a new one.

Link to comment
Share on other sites

I can't be specific without knowing exactly what you're trying to do. It seems you want the "More" button link to go to a separate website with it's own product page. If you go to my Image Gallery product page here, you'll see the Buy button redirects to http://addons.prestashop.com/en/front-office-features-prestashop-modules/22219-gallery.html to buy the module there. To do this, I changed the button code in product.tpl to:

<a href="http://addons.prestashop.com/{$language.iso_code}/front-office-features-prestashop-modules/{$product.reference}.html" class="btn btn-primary" target="_blank">
    <i class="material-icons shopping-cart"></i>
    {l s='Buy'}
</a>

As you can see, I have hardcoded the domain name, but I'm using the product reference to choose the page on PrestaShop Addons. You could do a similar thing in product-list.tpl by editing all the <a href=""> links with the domain of your other website and enter the page as the reference code on each of your products.

Link to comment
Share on other sites

You can create override/classes/Product.php with the following to increase the length of the reference field and change the validation function to isUrl():
<?php

class Product extends ProductCore
{
    public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
    {
        ProductCore::$definition['fields']['reference']['size'] = 128;
        ProductCore::$definition['fields']['reference']['validate'] = 'isUrl';

        parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
    }
}

You'll also need to edit the ps_product and ps_product_shop tables in your database using phpMyAdmin and increase the length of the reference field to 128 to match the code above.

Link to comment
Share on other sites

You'll need to edit product-list.tpl in your theme's directory and replace the {$link->getProductLink} with your custom URL.

Hello Rocky.

 

Do you know if is there another option to achieve that without touch product-list.tpl?

 

I mean, could i edit link attribute for a some products to set the page where show its details?

 

Thanks a lot for you help.

 

 

Link to comment
Share on other sites

I'm developing a module to custom product in a external page. 
 
I achieved to end customization and add product to cart, but, i would like that once the product is in the cart when the user click on it, it will go to external page instead to default page.

Also in the catalog list i would like to send some products to external page.
 
Any ideas?

Thanks for your time.
Link to comment
Share on other sites

  • 2 years 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...