Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Link from product to another shopping cart

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 08-28-2003, 03:04 PM
 
midori midori is offline
 

Member
  
Join Date: May 2003
Posts: 18
 

Default Link from product to another shopping cart

Is it possible to add a product to the store, but not allow customers to add it to their shopping cart? I would like to list a product in a category, but I want to add a link to another site where people can actually buy the product since I won't be carrying it.

Thanks for your help!
-Midori
Reply With Quote
  #2  
Old 08-29-2003, 09:02 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Yes, this is possible.

I have done this modification before by using one of the extra fields in the product table to hold a affiliate add to cart link url and then put a check into products.tpl and product.tpl to change the add to cart for a buy now button.

The buy now button has a href of the extra field param url.

I hope that isn't too much code speak for you.

Give me a shout if you want the mod done - would take about an hour.
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 08-29-2003, 09:14 AM
 
midori midori is offline
 

Member
  
Join Date: May 2003
Posts: 18
 

Default

So, you code a check to look for a link entry in the extra field, and if there's something in that field, then print the Buy Now button instead of the Add to Cart button? I'm going to try to hack away at that and see if I can figure it out.

Thanks so much for your help!
Reply With Quote
  #4  
Old 08-29-2003, 09:55 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

no probs.

I used:
Code:
{if $product.param00 eq ""} Put the normal add to cart stuff here {else} {include file="buttons/order_now.tpl"} {/if}

I used param00 but use whatever you feel fit.

you will also need to either switch off extra fields and add the param00 update box to the product_modify template in main or amend modules/extra_fields/product.tpl to stop it displaying the url in the product details.
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 09-04-2003, 04:43 PM
 
midori midori is offline
 

Member
  
Join Date: May 2003
Posts: 18
 

Default

Thanks again for your help! The fix works great!

-Midori
Reply With Quote
  #6  
Old 12-31-2003, 12:09 PM
 
jauman jauman is offline
 

Newbie
  
Join Date: Dec 2003
Posts: 3
 

Default Could you please elaborate?

Hi,

This is exactly what I need as well. Can you please give me a little more detail on what you did? I didn't follow this very well.

Thanks,
Jon
Reply With Quote
  #7  
Old 01-06-2004, 11:06 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

This is an example of product.tpl from a 3.3 version shop just to show you where the code went. I have commented the code for you:



Code:
{* $Id: product.tpl,v 1.59.2.2 2003/01/23 14:37:23 basil Exp $ *} {literal} <SCRIPT language=JavaScript1.2> <!-- function product_option(name_of_option) { {/literal} for(i=0; i<{php}echo count($product_options) {/php}; i++) if (document.orderform[i].name.search(name_of_option) != -1) return document.orderform[i]; return -1; {literal} } function FormValidation() { {/literal} {if $javascript_code} {$javascript_code} {else} return true; {/if} {literal} } --> </SCRIPT> {/literal} { include file="location.tpl" } {capture name=dialog} <table border=0 width=100%> <form name=orderform method=post action="cart.php?mode=add"> <tr> <td valign=top align=left rowspan=2 width=100> {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product} </td> <td valign=top> <span class=> {if $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{/if} </span> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td colspan=2><font class=ProductDetailsTitle>{$lng.lbl_details}</font></td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/orangespacer.gif[/img]</td></tr> <tr><td colspan=2></td></tr> {if $config.General.show_in_stock eq "Y" and $product.distribution eq ""} <tr><td width=30%>{$lng.lbl_quantity}</td><td nowrap>{if $product.avail gt 0}{$product.avail}{else}{$lng.txt_no}{/if} {$lng.txt_items_available}</td></tr> {/if} {if $product.weight ne "0.00"}<tr><td width=30%>{$lng.lbl_weight}</td><td nowrap>{$product.weight} {$config.General.weight_symbol}</td></tr>{/if} {* funkydunk - removed so that can show the product.param00 buy now button if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if end of removed extra fields *} {if $active_modules.Subscriptions ne "" and $subscription} {include file="modules/Subscriptions/subscription_info.tpl"} {else} {if $product.discount ne 0} <tr> <td class=MarketPrice>{$lng.lbl_market_price}: </td> <td><s> {math equation="price+discount" price=$product.price discount=$product.discount format="%.2f" assign=unformatted}{include file="currency.tpl" value=$unformatted} </s> </td> </tr> {/if} <tr><td class=ProductPriceConverting>{$lng.lbl_price}:</td> <td> {if $product.price ne 0} <font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.General.use_vat eq "Y"}, {$lng.lbl_including_vat} {$product.vat}%{/if} {else} <input type=text size=7 name=price> {/if} </td> </tr> {/if} </table> {* funkydunk - start of show if this is an in house product *} {if $product.param00 eq ""} <table border=0 width=100% cellpadding=0 cellspacing=0> <tr><td colspan=2></td></tr> {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"} {/if} <tr><td height=25 width=30%>{$lng.lbl_quantity}{if $product.min_amount gt 1} <FONT class=ProductDetailsTitle>{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</td> <td> {if $config.General.show_in_stock eq "Y" and ($product.avail le 0 or $product.avail lt $product.min_amount)} {$lng.txt_out_of_stock} {else} {if $config.General.show_in_stock ne "Y"} {assign var="mq" value=$config.General.max_select_quantity} {else} {math equation="min(maxquantity+minamount, productquantity)+1" assign="mq" maxquantity=$config.General.max_select_quantity minamount=$product.min_amount productquantity=$product.avail} {/if} {if $product.distribution eq ""} <select name=amount> {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</option> {/section} </select> {else} <font class=ProductDetailsTitle>1</font><input type=hidden name=amount value=1> {$lng.txt_product_downloadable} {/if} {/if} </td></tr> <tr><td colspan=2> <input type=hidden name=mode value=add> {if $config.General.show_in_stock ne "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)} {include file="customer/main/product_prices.tpl"} {include file="buttons/add_to_cart.tpl"} {if $login ne "" and $active_modules.Wishlist ne ""} {include file="customer/add2wl.tpl"} {/if} {/if} </td> </tr></table> {* funkydunk - end of in house product *} {else} {* funkydunk - start of external product *} <table border=0 width=100% cellpadding=0 cellspacing=0> <tr><td colspan=2></td></tr> <tr><td colspan=2> {include file="buttons/order_now.tpl"} </td></tr> </table> {/if} {* end of external product *} </td> <input type=hidden name=productid value="{$product.productid}"> <input type=hidden name=cat value="{$smarty.get.cat}"> <input type=hidden name=page value="{$smarty.get.page}"> </form> </table> {/capture} {include file="dialog.tpl" title=$product.product content=$smarty.capture.dialog extra="width=100%"} {if $active_modules.Detailed_Product_Images ne ""} {include file="modules/Detailed_Product_Images/product_images.tpl" } {/if} {if $active_modules.Upselling_Products ne ""} {include file="modules/Upselling_Products/related_products.tpl" } {/if} {if $active_modules.Recommended_Products ne ""} {include file="modules/Recommended_Products/recommends.tpl" } {/if} {if $active_modules.Customer_Reviews ne ""} {include file="modules/Customer_Reviews/vote_reviews.tpl" } {/if}
__________________
ex x-cart guru
Reply With Quote
  #8  
Old 01-09-2004, 12:47 PM
 
jauman jauman is offline
 

Newbie
  
Join Date: Dec 2003
Posts: 3
 

Default

funkydunk, thank you so much for your reply. I'm using version 3.5 and it does not seem to work. Here is my /customer/main/product.tpl. Any ideas?
Code:
{* $Id: product.tpl,v 1.78 2003/11/12 10:26:28 svowl Exp $ *} {include file="check_product_options_js.tpl"} {include file="location.tpl"} {if $product.product_type eq "C"} {include file="modules/Product_Configurator/pconf_customer_product.tpl"} {else} {capture name=dialog} <table border=0 width=100%> <form name=orderform method=post action="cart.php?mode=add"> <tr> <td valign=top align=left rowspan=2 width=100> {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url} </td> <td valign=top> <span class=> {if $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{/if} </span> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td colspan=2><font class=ProductDetailsTitle>{$lng.lbl_details}</font></td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/spacer.gif[/img]</td></tr> <tr><td colspan=2></td></tr> {if $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne "Y" and $product.distribution eq ""} <tr><td width=30%>{$lng.lbl_quantity}</td><td nowrap>{if $product.avail gt 0}{$product.avail}{else}{$lng.txt_no}{/if} {$lng.txt_items_available}</td></tr> {/if} {if $product.weight ne "0.00"}<tr><td width=30%>{$lng.lbl_weight}</td><td nowrap>{$product.weight} {$config.General.weight_symbol}</td></tr>{/if} {*removed for PartnerLink if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if end of removed *} {if $active_modules.Subscriptions ne "" and $subscription} {include file="modules/Subscriptions/subscription_info.tpl"} {else} <tr><td class=ProductPriceConverting>{$lng.lbl_price}:</td> <td> {if $product.price ne 0} <font class=ProductDetailsTitle>{include file="currency.tpl" value=$product.price}</font><font class=MarketPrice> {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price}</font>{if $config.Taxes.use_vat eq "Y" and $product.vat gt "0"}, {$lng.lbl_including_vat} {$product.vat}%{/if} {else} <input type=text size=7 name=price> {/if} </td> </tr> {/if} </table> {* funkydunk - start of show if this is an in house product *} {if $product.PartnerLink eq ""} <table border=0 width=100% cellpadding=0 cellspacing=0> <tr><td colspan=2> <font class=ProductDetailsTitle>{$lng.lbl_options}</font> </td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/spacer.gif[/img]</td></tr> <tr><td colspan=2></td></tr> {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"} {/if} <tr><td height=25 width=30%>{$lng.lbl_quantity}{if $product.min_amount gt 1} <FONT class=ProductDetailsTitle>{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</td> <td> {if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount)} {$lng.txt_out_of_stock} {else} {if $config.General.unlimited_products eq "Y"} {math equation="x+1" assign="mq" x=$config.Appearance.max_select_quantity} {else} {math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"} {if $tmp<2} {assign var="minamount" value=$product.min_amount} {else} {assign var="minamount" value=0} {/if} {math equation="min(maxquantity+minamount, productquantity)+1" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$product.min_amount productquantity=$product.avail} {/if} {if $product.distribution eq ""} <select name=amount> {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</option> {/section} </select> {else} <font class=ProductDetailsTitle>1</font><input type=hidden name=amount value=1> {$lng.txt_product_downloadable} {/if} {/if} </td></tr> <tr><td colspan=2> <input type=hidden name=mode value=add> {include file="customer/main/product_prices.tpl"} {if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)} {if $js_enabled} {if $smarty.get.pconf ne ""} <INPUT type=hidden name="slot" value="{$smarty.get.slot}"> <INPUT type=hidden name="addproductid" value="{$product.productid}"> {include file="buttons/pconf_add_to_configuration.tpl" style="button"} {/if} {include file="buttons/add_to_cart.tpl" style="button"} {if $login ne "" and $active_modules.Wishlist ne ""} {include file="customer/add2wl.tpl"} {/if} {else} {include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart} {/if} {/if} <input type=image src="{$ImagesDir}/null.gif" width=10 height=10 border=0 align=top> </td> </tr></table> {* funkydunk - end of in house product *} {else} {* funkydunk - start of external product *} <table border=0 width=100% cellpadding=0 cellspacing=0> <tr><td colspan=2></td></tr> <tr><td colspan=2> {include file="buttons/buy_now.tpl"} </td></tr> </table> {/if} {* end of external product - there is no order_now.tpl in 3.5 *} </td> <td align=right valign=top width=60> {if $product.list_price gt 0 and $product.price lt $product.list_price}<table border=0 width=60><tr><td width=55 height=56 class="SaveMoneyLabel" background="{$ImagesDir}/save_money.gif" align=center valign=middle> {math equation="100-(price/lprice)*100" price=$product.price lprice=$product.list_price format="%d" assign=discount} { $discount }% </td></tr></table>{/if} </td> </tr> <input type=hidden name=productid value="{$product.productid}"> <input type=hidden name=cat value="{$smarty.get.cat|escape:"html"}"> <input type=hidden name=page value="{$smarty.get.page|escape:"html"}"> </form> </table> {/capture} {include file="dialog.tpl" title=$product.producttitle content=$smarty.capture.dialog extra="width=100%"} {/if} {if $active_modules.Detailed_Product_Images ne ""} {include file="modules/Detailed_Product_Images/product_images.tpl" } {/if} {if $active_modules.Upselling_Products ne ""} {include file="modules/Upselling_Products/related_products.tpl" } {/if} {if $active_modules.Recommended_Products ne ""} {include file="modules/Recommended_Products/recommends.tpl" } {/if} {if $active_modules.Customer_Reviews ne ""} {include file="modules/Customer_Reviews/vote_reviews.tpl" } {/if}
-----------
Thanks! -Jon[/code]
Reply With Quote
  #9  
Old 01-09-2004, 06:50 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Please post your code between {code} {/code} tags (substitute { with [ and } with ]).
Reply With Quote
  #10  
Old 01-09-2004, 10:47 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Hi

I used one of the param fields to hold this info - you seem to be referring to a field in the product table called PartnerLink. Unless you have added this to your products table and amended all of the php scripts to store a value into this, it wont work.

replace $product.PartnerLink for $product.param08 and it will work.
__________________
ex x-cart guru
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:53 PM.

   

 
X-Cart forums © 2001-2020