- Posts: 1
- Thank you received: 0
Converting "Add to Cart" to link to an outside URL
Hi
I am looking to add showcasing of affiliate marketing products to a site and considering Hikashop.
Similar to drop shipping, we list items from varies vendors BUT we only list items and send the visitor to the original vendor using the affiliate link (ie amazon).
Therefore, we need to
1) Replace "Add to Cart" to "Buy it Now" (ok this is just change of language and easy).
2) This button should use the url (brand url!?) link to open a new window.
Is this possible? For both, category and product listings?
Perhaps, it would be easier using a CCK! but I want full power of a shopping cart (specialty import/export to use the vendors data feed)
Thank you
Please Log in or Create an account to join the conversation.
Yes it is indeed possible, it will just require the edition of the view "product / quantity" and "product / add_to_cart_listing".
In these views, replace the button, by a custom one getting the link from the value $this->row->product_url; (or $this->element->product_url) and fill the Url field in the product edition page.
To rename it, as you said it is juste a translation override.
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
I am also looking for the same thing. Use hikashop for affiliates.
So as I would also like to change the add to cart by buy it now for each item id go to each different url affiliates.
Would you mind to give me the entire little piece of php code in order to implement it?
I would need exact code for:
product / quantity" and "product / add_to_cart_listing I guess, as far as you said.
and also the exact code for:
replace the button, by a custom one getting the link from the value $this->row->product_url; (or $this->element->product_url) and fill the Url field in the product edition page
Honored Xavier
Please Log in or Create an account to join the conversation.
It's basic HTML, javascript and PHP, like that:
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Shall I change any piece of code inside
product / quantity" and "product / add_to_cart_listing ?
May you kindly give me an example code for demo affiliates?
So by the way, what happens if I have 100 products ids and I want each different product to go a one different affiliates url?
I guess that I shall implement 100 different codes, one by one, depending on the product ID. Is that right?
Can you kindly provide me a demo url to go? This code is not complete for that my dear.
<input type="button" onclick="window.location='<?php echo $this->row->product_url; ?>'; return false;" value="buy now"/>
Honored
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Please Log in or Create an account to join the conversation.
The code is complete.
Just add it to the view and you should see a new button appear that you can click on and which will redirect you to the URL that your entered in the "URL" field of each product.
So there is no need for a different code for each product. You however need to configure the redirection URL in each product.
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
I am attaching you the complete piece of code for add_to_cart_listing.php
I guess that is the same accesible from www\your_site\components\com_hikashop\views\product\tmpl
And also i do not know what do you stand for :
You however need to configure the redirection URL in each product.
2.you can check your piece of code at the end, where the input buttons are. Shall I also include it on product / quantity.php?
so somewhere should I include the affiliates urls, deppending on different product IDS.
Sorry for my ignorance. please check code inside add_to_cart_listing.php
*****
Please Log in or Create an account to join the conversation.
There is no need to know PHP or HTML. Copy/paste the code I gave you at the top or at the end of the view files and you'll see the button where the view is used.
The only thing left to do then is to enter the URL where you want the customer to go in the "URL" field of the product edition page.
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
I am still trying this piece of code but nothing happens.
By the way, when adding this piece of code you sent me here, only appears the button buy now, when on clicking nothing happens, because you did ot sent me the example piece of code for outside urls deppending on different products.
For example for product1 I want to go to www.amazon/1
product2 go to www.ebay.com/2
Shall I create a table or something inside sql? Do I need to add any other .php somewhere?
And last question, how to delete the add to cart and start using the new button? What about using the same add to cart button? would be even better, and when clicking on it, deppending on the product, it shall go to a different external url, instead to:
<form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>
I have attached a picture and sent you the url by private.
Thanks
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Please Log in or Create an account to join the conversation.
I already sent you the example piece of code for outside URLs depending on different products !
As I already said, use that code:
<input type="button" onclick="window.location='<?php echo $this->row->product_url; ?>'; return false;" value="buy now"/>
and in each product edition page, enter the URL that you want for the buy now button in the "URL" field.
I'm sorry but it's already three times I told you what to do... I can't tell you more than what I already told you since that's the solution. There is no need to create a table, or do something in SQL, or add any other php. Just follow what I say and that's it.
If you want to have a specific styling on the button, that's possible. Just add custom CSS code for that.
www.hikashop.com/support/support/documen...ize-the-display.html
And if you don't want the add to cart buttons, just turn off the "Display add to cart buttons" option of your menu via the menu Display>Content menus.
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Apologies for my previous answers, but I am not familiar with advanced php for objects.
Regarding your answer, when including www.amazon.com for example inside the URL field , the URLS now displayes at the end of the page product as Brand URL, but the bottom is not created inside the product page, at the same position where add to cart was.
The buttom was created for categories, but from there when clicking on it, nothing happens.
I am sending you the website with your administrator URL and password, so as you can freely check.
I am also including a screenshot.
Honored dear
Please Log in or Create an account to join the conversation.
That's totally normal. Your questions didn't mention the product page, only the listings.
If you want that button for both the product page and the listings, then instead of adding the custom code in the add_to_cart_listing view file, you should add it in the quantity view file and remove the line below which displays the normal add to cart:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'), 'add', $this->params, $url, $this->ajax, '', $max, $min);
And to remove the "brand url" link from the product page, you can add such CSS on your frontend CSS file:
#hikashop_product_url_main{ display: none; }
www.hikashop.com/support/support/documen...ize-the-display.html
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
I will try later and I will inform you. You rock
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
I have followed your steps, and it gives me a big Parse error: syntax error, unexpected '<' in /html/com_hikashop/product/quantity.php on line 94
exactly that line, where I included the
<input type="button" onclick="window.location='<?php echo $this->row->product_url; ?>'; return false;" value="buy now"/>
in quantity.php
after deleting on that line 94:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'), 'add', $this->params, $url, $this->ajax, '', $max, $min);
also deleted
<input type="button" onclick="window.location='<?php echo $this->row->product_url; ?>'; return false;" value="buy now"/>
on add_to_cart_listing.php
I am sending you the private credentials to access. you can freely touch everything because is offline. I created a supper user for you.
Just inform me here after changes. Maybe also other people would be interested on the answer.
Check the private message I have sent you here. Thank you
P.S.
Would be easier if someone might directly change, edit and save changes o add to cart HTML link, on each product, but there is no option to save.
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Cheers
Please Log in or Create an account to join the conversation.
There was an error because the code used is HTML code and not PHP, so you have to close the php tag before and re-open it after, like that:
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
FInally after 2 weeks, we almost ended up with the solution.
i have seen that you actually included the code above to quantity.phpwith the credentials I sent you by private, ok great, now the button appears on all articles (not in categories), but.. when editing one product article and including the URL on the URL field, the url only appears below, by brand URL and not by clicking that buttons.
May you kindly check it? you have full access by the private credentials to the microniche.
2. And also... how might we include the rel = no follow on that php urls?
Honored, and luckily finishing today with this topic
Please Log in or Create an account to join the conversation.
- Posts: 36
- Thank you received: 0
Please Log in or Create an account to join the conversation.