Buying Small and easy (hopefully) PHP URL Fix for X-Cart Products

Discussion in 'Services' started by BannanoPeel, Mar 22, 2010.

  1. #1
    This URL has more info: http://forums.digitalpoint.com/showthread.php?t=1740976#post13862965

    I need to be able for a customer to click on a button on a product page and be able to add that product ($productid) + An Add-on (productid=4).

    Here is the complete code:

    {*
    $Id: product_details.tpl,v 1.96.2.3 2009/11/10 15:00:49 joy Exp $
    vim: set ts=2 sw=2 sts=2 et:
    *}
    <form name="orderform" method="post" action="cart.php" onsubmit="javascript: return FormValidation(this);" style="width:500px;">
      <input type="hidden" name="mode" value="{if $active_modules.Gift_Registry and $wishlistid}wl2cart{else}add{/if}" />
      <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"}" />
      {if $active_modules.Gift_Registry and $wishlistid}
        <input type="hidden" name="fwlitem" value="{$wishlistid}" />
        <input type="hidden" name="eventid" value="{$eventid}" />
      {/if}
        
        
        
        
      
        
        
     
      <table cellspacing="0" class="product-properties" summary="{$lng.lbl_description|escape}" width="500"  >
       
        {if $config.Appearance.show_in_stock eq "Y" && $config.General.unlimited_products ne "Y" && $product.distribution eq ""}
          <tr>
            <td class="property-name">{$lng.lbl_in_stock}</td>
            <td class="property-value product-quantity-text" colspan="2">
              {if $product.avail gt 0}
                {$lng.txt_items_available|substitute:"items":$product.avail}
              {else}
                {$lng.lbl_no_items_available}
              {/if}
            </td>
          </tr>
        {/if}
        {if $product.weight ne "0.00" || $variants ne ''}
          <tr id="product_weight_box"{if $product.weight eq '0.00'} style="display: none;"{/if}>
            <td class="property-name">{$lng.lbl_weight}</td>
            <td class="property-value" colspan="2">
              <span id="product_weight">{$product.weight|formatprice}</span> {$config.General.weight_symbol}
            </td>
          </tr>
        {/if}
        
       </div> 
      
     
        
        {if $active_modules.Feature_Comparison}
          {include file="modules/Feature_Comparison/product.tpl"}
        {/if}
        {if $product.forsale neq "B" || ($product.forsale eq "B" && $smarty.get.pconf ne "" && $active_modules.Product_Configurator)}
          {if $active_modules.Product_Options ne ""}
            {if ($active_modules.Extra_Fields && $extra_fields) || ($active_modules.Feature_Comparison && $product.features.options)}
              <tr>
            {*    <td colspan="3" class="poptions-product-separator">&nbsp;</td>  *}
              </tr>
            {/if}
            {include file="modules/Product_Options/customer_options.tpl" disable=$lock_options}
          {/if}
        {/if}
        {if $active_modules.Subscriptions && $subscription}
          {include file="modules/Subscriptions/subscription_info.tpl"}
        {else}
          {if $product.appearance.has_market_price && $product.appearance.market_price_discount gt 0}
            <tr>
              <td class="property-name product-taxed-price">{$lng.lbl_market_price}:</td>
              <td class="property-value product-taxed-price" colspan="2">{include file="currency.tpl" value=$product.list_price}</td>
            </tr>
          {/if}
          
        
      
        
          
          <tr{if $product.appearance.has_market_price && $product.appearance.market_price_discount gt 0} class="product-price-row"{/if}>
            <td class="property-name product-price" valign="top">{$lng.lbl_our_price}:</td>
            <td class="property-value" valign="top" colspan="2">
            {if $product.taxed_price ne 0 || $variant_price_no_empty}
              <span class="product-price-value">{include file="currency.tpl" value=$product.taxed_price tag_id="product_price"}</span>
              <span class="product-market-price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price tag_id="product_alt_price"}</span>
              {if $product.taxes}
                <br />{include file="customer/main/taxed_price.tpl" taxes=$product.taxes}
              {/if}
            {else}
              <input type="text" size="7" name="price" />
            {/if}
            </td>
          </tr>
          {if $product.forsale ne "B"}
            <tr>
              <td colspan="3">{include file="customer/main/product_prices.tpl"}</td>
            </tr>
          {/if}
        {/if}
        {if $product.forsale neq "B" || ($product.forsale eq "B" && $smarty.get.pconf ne "" && $active_modules.Product_Configurator)}
      <tr class="quantity-row">
            {if $product.appearance.empty_stock && ($variants eq '' || ($variants ne '' && $product.avail le 0))}
              <td class="property-name product-input">{$lng.lbl_quantity}</td>
              <td class="property-value" colspan="2">
              
              
              
    <script type="text/javascript">
    <!--
    var min_avail = 1;
    var avail = 0;
    var product_avail = 0;
    -->
    </script>
                <strong>{$lng.txt_out_of_stock}</strong>
              </td>
            {elseif !$product.appearance.force_1_amount && $product.forsale ne "B"}
              <td class="property-name product-input">
                {if $config.Appearance.show_in_stock eq "Y" and not $product.appearance.quantity_input_box_enabled and $config.General.unlimited_products ne 'Y'}
                  {$lng.lbl_quantity_x|substitute:quantity:$product.avail}
                {else}
                  {$lng.lbl_quantity}
                {/if}
              </td>
              <td class="property-value" colspan="2">
    <script type="text/javascript">
    <!--
    var min_avail = {$product.appearance.min_quantity|default:1};
    {assign var="mq" value=$product.max_amount}
    var product_avail = {$product.avail|default:"0"};
    -->
    </script>
                <input type="text" id="product_avail_input" name="amount" maxlength="11" size="6" onchange="javascript: return check_quantity_input_box(this);" value="{$smarty.get.quantity|default:$product.appearance.min_quantity}"{if not $product.appearance.quantity_input_box_enabled} disabled="disabled" style="display: none;"{/if}/>
                {if $product.appearance.quantity_input_box_enabled and $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne 'Y'}
                  <span id="product_avail_text" class="quantity-text">{$lng.lbl_product_quantity_from_to|substitute:"min":$product.appearance.min_quantity:"max":$product.avail}</span>
                {/if}
                <select id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && ($product_options ne '' || $product_wholesale ne '')} onchange="javascript: check_wholesale(this.value);"{/if}{if $product.appearance.quantity_input_box_enabled} disabled="disabled" style="display: none;"{/if}>
                    <option value="{$product.appearance.min_quantity}"{if $smarty.get.quantity eq $product.appearance.min_quantity} selected="selected"{/if}>{$product.appearance.min_quantity}</option>
                  {if not $product.appearance.quantity_input_box_enabled}
                    {section name=quantity loop=$product.appearance.loop_quantity start=$product.appearance.min_quantity}
                      {if %quantity.index% ne $product.appearance.min_quantity}
                        <option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected" {/if}>{%quantity.index%}</option>
                      {/if}
                    {/section}
                  {/if}
                </select>
              </td>
            {else}
              <td class="property-name product-input">{$lng.lbl_quantity}</td>
              <td class="property-value" colspan="2">
    <script type="text/javascript">
    <!--
    var min_avail = 1;
    var avail = 1;
    var product_avail = 1;
    -->
    </script>
          
     
                <span class="product-one-quantity">1</span>
                <input type="hidden" name="amount" value="1" />
            
        {if $product.distribution ne ""}
      {*            {$lng.txt_product_downloadable} *}
                {/if}
              </td>
            {/if}
          </tr>
          {if $product.min_amount gt 1}
            <tr>
              <td colspan="3" class="property-value product-min-amount">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</td>
            </tr>
          {/if}
        {/if}
        
      </table>
      
     [COLOR="GREEN"] 
      <div id="alternate" style="float:right;">
      
      
          <div class="buttons-row buttons-auto-separator">
            {include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button add-to-cart-button"}
       
     {if $product.appearance.buy_now_buttons_enabled}
        {if $product.forsale ne "B"}
          <div class="buttons-row buttons-auto-separator">
      <a href="cart.php?mode=add&amp;productid=17533&amp;add&amp;$productid&amp;amount=1&amp;redirect_to_cart=Y">
            {include file="CD.tpl" type="input" additional_button_class="main-button add-to-cart-button"}
    </a>
            {if $product.appearance.dropout_actions && $js_enabled}
              {include file="customer/buttons/add_to_list.tpl" id=$product.productid js_if_condition="FormValidation()"}
            {elseif $product.appearance.buy_now_add2wl_enabled && $js_enabled}
              {include file="customer/buttons/add_to_wishlist.tpl" href="javascript: if (FormValidation()) submitForm(document.orderform, 'add2wl', arguments[0]);"}
            {/if}
           <div class="buttons-row buttons-auto-separator">
      <a href="cart.php?mode=add&amp;productid=17534&amp;amount=1&amp;redirect_to_cart=Y">
            {include file="USB.tpl" type="input" additional_button_class="main-button add-to-cart-button"}
    </a>
         </div>
     
           <div class="buttons-row buttons-auto-separator">
      <a href="cart.php?mode=add&amp;productid=17535&amp;amount=1&amp;redirect_to_cart=Y">
            {include file="Paper.tpl" type="input" additional_button_class="main-button add-to-cart-button"}
    </a>
         </div>
      [/COLOR]
        </div>
      
      </div>
     
          </div>
        {else}
          {$lng.txt_pconf_product_is_bundled}
        {/if}
        {if $smarty.get.pconf ne "" && $active_modules.Product_Configurator && $js_enabled}
          <input type="hidden" name="slot" value="{$smarty.get.slot}" />
          <input type="hidden" name="addproductid" value="{$product.productid}" />
          <div class="button-row">
            {include file="customer/buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration href="javascript: if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`'; document.orderform.action='pconf.php'; document.orderform.submit();`$rdelim`" additional_button_class="light-button"}
          </div>
          {if $product.appearance.empty_stock}
            <p class="message">
              <strong>{$lng.lbl_note}:</strong> {$lng.lbl_pconf_slot_out_of_stock_note}
            </p>
          {/if}
          {if $product.appearance.min_quantity eq $product.appearance.max_quantity}
            <p>{$lng.txt_add_to_configuration_note|substitute:"items":$product.appearance.min_quantity}</p>
          {/if}
        {/if}
      {/if}
      
     
      
      
      
    </form>
    <br /> <br /> <br /> <br /> <br /> <br /><br /> <br /> <br /><br /> <br /> <br />
     <table cellspacing="0" cellpadding="0" summary="{$lng.lbl_description|escape}">
      
     
        <tr>
        
        
         <div class="descr">
        
          <td class="descr"> <h3>Product Description:</h3> {$product.fulldescr|default:$product.descr}</td>    
       </div>
         
           
          {if $active_modules.Special_Offers}
            {include file="modules/Special_Offers/customer/product_bp_icon.tpl"}
          {/if}
          {if $product.appearance.has_market_price && $product.appearance.market_price_discount gt 0}
            <td align="right" valign="top">
              <div class="save-percent-container">
                <div class="save" id="save_percent_box">
                  <span id="save_percent">{$product.appearance.market_price_discount}</span>%
                </div>
              </div>
              				
            </td>
          {/if}
        </tr>
      </table>
      
        <table cellspacing="0" class="product-properties" summary="{$lng.lbl_description|escape}">
       <tr>
         <br/>  <br/>  <br/>
        {if $active_modules.Extra_Fields}
          <td class="property-name">{$lng.lbl_sku}</td>
          <td class="property-value" id="product_code" colspan="2">{$product.productcode|escape}</td>
          {include file="modules/Extra_Fields/product.tpl"}
      <br />
       <h3>Technical Details:</h3>
        {/if}
      </tr>
      </table>
      
    {if $active_modules.Product_Options && ($product_options ne '' || $product_wholesale ne '') && ($product.product_type ne "C" || !$active_modules.Product_Configurator)}
    <script type="text/javascript">
    <!--
    setTimeout(check_options, 200);
    -->
    </script>
    {/if}
       
       
      
    
    Code (markup):
    I don't care what the solution is as long as it works on all browsers. First Person to post the correct answer I will paypal $2.50.
     
    BannanoPeel, Mar 22, 2010 IP