X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Remove Quantity on Details Page (https://forum.x-cart.com/showthread.php?t=58807)

minfinger 04-07-2011 07:29 PM

Remove Quantity on Details Page
 
I've got one product on the whole site that is used as a Deposit, it's a single item purchase, so I don't need customers selecting quantities.

I'd like to hide the Quantity and the Drop Down.

I'm pretty sure I need this: $product.productcode eq 'Deposit' But I don't know where to put it.

I've tried putting it on the product_details.tpl but I'm doing something wrong. I've been modifying the common_files version, because I'm using the 3-column template and there's not product_details.tpl in the 3-column folder.

cherie 04-08-2011 02:31 PM

Re: Remove Quantity on Details Page
 
If it's not there then it will use the one from common_files. Copy the file to the same place in 3-columns and edit it there. :)

a333 04-09-2011 09:14 AM

Re: Remove Quantity on Details Page
 
the quantity box code is in buy_now.tpl.

what i did was create a div class around the quantity box called "hidden" with the css code "visibility:hidden".

this will keep the quanitiy box there( which is necessary to add to cart) but hides it from view.

you can also add a margin-bottom: -30px within the "hidden" css if your worried about the empty space so that that "buy" button moves up the fill the gap.

minfinger 04-09-2011 11:49 AM

Re: Remove Quantity on Details Page
 
a333,

I removed the Buy Now feature from the site. I'm speaking specifically about the drop down on the product details page.

See my current example:
http://www.mikeinfinger.com/demos/xcart/Party-Deposit.html

The whole quantity section has bee removed with the exception of the 1, which I will probably use your "hidden" css to take care of that.

My next problem is after adding it to the cart, they can now change the quantity.

I've breifly looked into it, but I cannot figure out which tpl to modify to "hide" the option to increase the quantity, using my if/then statement I should be able to only hide it for the Party.

Here is a regular product with the quantity showing:
http://www.mikeinfinger.com/demos/xcart/Monster-Caramel-Chocolate-Apple-Cashew.html

qualiteam 04-19-2011 04:48 AM

Re: Remove Quantity on Details Page
 
The template can very depending on the skin, thus please try the "Webmaster mode". It should help locating the proper template.

minfinger 04-19-2011 04:49 AM

Re: Remove Quantity on Details Page
 
Thanks Alex, my mod seems to be working well on my 3 Column template. Nice to see you posting ;)

techker 05-18-2011 02:03 PM

Re: Remove Quantity on Details Page
 
Quote:

Originally Posted by a333
the quantity box code is in buy_now.tpl.

what i did was create a div class around the quantity box called "hidden" with the css code "visibility:hidden".

this will keep the quanitiy box there( which is necessary to add to cart) but hides it from view.

you can also add a margin-bottom: -30px within the "hidden" css if your worried about the empty space so that that "buy" button moves up the fill the gap.


can you show your code?

minfinger 11-14-2011 11:18 AM

Re: Remove Quantity on Details Page
 
Bringing back an old thread of mine with the code.

Modify this file: skin/common_files/customer/main/product_details.tpl

The following code removes the SKU # and Quantity Options from the Product Details Page:
(I had to take out the first 37 lines because it was to long to post)
Code:

  <table cellspacing="0" class="product-properties" summary="{$lng.lbl_description|escape}">

    <tr>
      <td colspan="3" class="product-subtitle">
        <div>{$lng.lbl_details}</div>
      </td>
    </tr>

{*    <tr>
      <td class="property-name">{$lng.lbl_sku}</td>
      <td class="property-value" id="product_code" colspan="2">{$product.productcode|escape}</td>
    </tr>*}

    {if $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne "Y" and $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" or $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}

    {if $active_modules.Extra_Fields}
      {include file="modules/Extra_Fields/product.tpl"}
    {/if}

    {if $active_modules.Feature_Comparison}
      {include file="modules/Feature_Comparison/product.tpl"}
    {/if}

    {if $active_modules.Subscriptions and $subscription}
      {include file="modules/Subscriptions/subscription_info.tpl"}
    {else}

      <tr class="separator">
        <td colspan="3">&nbsp;</td>
      </tr>

      {if $product.appearance.has_market_price and $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">{currency value=$product.list_price}</td>
        </tr>
      {/if}

      <tr>
        <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 or $variant_price_no_empty}
          <span class="product-price-value">{currency value=$product.taxed_price tag_id="product_price"}</span>
          <span class="product-market-price">{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}

    <tr>
      <td colspan="3" class="product-subtitle">
        <div>{$lng.lbl_options}</div>
      </td>
    </tr>

    {if $product.forsale neq "B" or ($product.forsale eq "B" and $smarty.get.pconf ne "" and $active_modules.Product_Configurator)}

      {if $active_modules.Product_Options ne ""}
        {include file="modules/Product_Options/customer_options.tpl" disable=$lock_options}
      {/if}

      <tr class="quantity-row">

        {if $product.appearance.empty_stock and ($variants eq '' or ($variants ne '' and $product.avail le 0))}

          <td class="property-name product-input">{$lng.lbl_quantity}</td>
          <td class="property-value" colspan="2">

<script type="text/javascript">
//<![CDATA[
var min_avail = 1;
var avail = 0;
var product_avail = 0;
//]]>
</script>

            <strong>{$lng.txt_out_of_stock}</strong>
          </td>

        {elseif not $product.appearance.force_1_amount and $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">
//<![CDATA[
var min_avail = {$product.appearance.min_quantity|default:1};
var avail = {$product.appearance.max_quantity|default:1};
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 '' and ($product_options ne '' or $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">
//<![CDATA[
var min_avail = 0;
var avail = 0;
var product_avail = 0;
//]]>
</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>

  {if $product.appearance.buy_now_buttons_enabled}

    {if $product.forsale ne "B"}

      <ul class="simple-list">
      <li>
      <div class="buttons-row buttons-auto-separator">

        {include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}

        {if $product.appearance.dropout_actions}
          {include file="customer/buttons/add_to_list.tpl" id=$product.productid js_if_condition="FormValidation()"}

        {elseif $product.appearance.buy_now_add2wl_enabled}
          {include file="customer/buttons/add_to_wishlist.tpl" href="javascript: if (FormValidation()) submitForm(document.orderform, 'add2wl', arguments[0]);"}
        {/if}

      </div>
      </li>

      {if $config.Company.support_department neq ""}
      <li>
     
      <div class="ask-question">
        {include file="customer/buttons/button.tpl" button_title=$lng.lbl_ask_question_about_product style="link" href="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`')"}
      </div>

      <div class="clearing"></div>
      </li>
      {/if}

      </ul>

    {else}

      {$lng.txt_pconf_product_is_bundled}

    {/if}

    {if $smarty.get.pconf ne "" and $active_modules.Product_Configurator}

      <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>
{if $active_modules.Product_Options and ($product_options ne '' or $product_wholesale ne '') and ($product.product_type ne "C" or not $active_modules.Product_Configurator)}
<script type="text/javascript">
//<![CDATA[
setTimeout(check_options, 200);
//]]>
</script>
{/if}


minfinger 11-14-2011 11:24 AM

Re: Remove Quantity on Details Page
 
In this version, you can see where I started right after the Options Label around line 120. I also disable the SKU #, but that code is not shown. Inserted {if} statements to determine whether or not the $product.productcode = 'Party Deposit1'. If it was, it disabled a warning message and hides of the quantity input and makes it a quantity of 1.

Code:

    <tr>
      <td colspan="3" class="product-subtitle">
        <div>{$lng.lbl_options}</div>
      </td>
    </tr>

    {if $product.forsale neq "B" or ($product.forsale eq "B" and $smarty.get.pconf ne "" and $active_modules.Product_Configurator)}

      {if $active_modules.Product_Options ne ""}
        {include file="modules/Product_Options/customer_options.tpl" disable=$lock_options}
            {if $product.productcode eq 'Party Deposit1'}
            {else}
            <br />
            <font size="1" color="#FF0000"><b>ATTENTION: Packages containing any items with chocolate or candy that could melt that are sent to warm climates must utilize cold packs.  ONLY 1 Cold Pack per Order is needed.  All Nuts without chocolate do not require Cold Packs, except boiled Peanuts.  We recommend Next Day Shipping During warm months! Sorry, no refunds for melted products.</b></font><br />
        {/if}
        <br />
        <font size="1" color="#FF0000"><b>All chocolate items are manufactured in a facility that produces items that may contain peanuts, and tree nuts.</b></font>
    {/if}

      {if $product.productcode eq 'Party Deposit1'}
      <tr>
            <td></td>
          <td>
<script type="text/javascript">
//<![CDATA[
var min_avail = 1;
var avail = 1;
var product_avail = 1;
//]]>
</script>

            <span class="product-one-quantity"></span>
            <input type="hidden" name="amount" value="1" />
          </td>
      </tr>
      {else}
      <tr class="quantity-row">

        {if $product.appearance.empty_stock and ($variants eq '' or ($variants ne '' and $product.avail le 0))}

          <td class="property-name product-input">{$lng.lbl_quantity}</td>
          <td class="property-value" colspan="2">

<script type="text/javascript">
//<![CDATA[
var min_avail = 1;
var avail = 0;
var product_avail = 0;
//]]>
</script>

            <strong>{$lng.txt_out_of_stock}</strong>

          </td>

        {elseif not $product.appearance.force_1_amount and $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">
//<![CDATA[
var min_avail = {$product.appearance.min_quantity|default:1};
var avail = {$product.appearance.max_quantity|default:1};
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 '' and ($product_options ne '' or $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">
//<![CDATA[
var min_avail = 0;
var avail = 0;
var product_avail = 0;
//]]>
</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}
      {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>

  {if $product.appearance.buy_now_buttons_enabled}

    {if $product.forsale ne "B"}

      <ul class="simple-list">
      <li>
      <div class="buttons-row buttons-auto-separator">

        {include file="customer/buttons/add_to_cart.tpl" type="input" additional_button_class="main-button"}

        {if $product.appearance.dropout_actions}
          {include file="customer/buttons/add_to_list.tpl" id=$product.productid js_if_condition="FormValidation()"}

        {elseif $product.appearance.buy_now_add2wl_enabled}
          {include file="customer/buttons/add_to_wishlist.tpl" href="javascript: if (FormValidation()) submitForm(document.orderform, 'add2wl', arguments[0]);"}
        {/if}

      </div>
      </li>

      {if $config.Company.support_department neq ""}
      <li>
     
      <div class="ask-question">
        {include file="customer/buttons/button.tpl" button_title=$lng.lbl_ask_question_about_product style="link" href="javascript: return !popupOpen(xcart_web_dir + '/popup_ask.php?productid=`$product.productid`')"}
      </div>

      <div class="clearing"></div>
      </li>
      {/if}

      </ul>

    {else}

      {$lng.txt_pconf_product_is_bundled}

    {/if}

    {if $smarty.get.pconf ne "" and $active_modules.Product_Configurator}

      <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>
{if $active_modules.Product_Options and ($product_options ne '' or $product_wholesale ne '') and ($product.product_type ne "C" or not $active_modules.Product_Configurator)}
<script type="text/javascript">
//<![CDATA[
setTimeout(check_options, 200);
//]]>
</script>
{/if}


minfinger 11-14-2011 11:33 AM

Re: Remove Quantity on Details Page
 
I also figured out that if you open /common_files/customer/main/cart.tpl and put {*}around line 77 that it turns off the ability for the customer to change the quantity. I assume there's probably some way to if/then/else it based on the $product.productcode, but I haven't tried it yet. If I figure that out, I'll post it.

Code:

<span class="product-price-text">
  {*{currency value=$price} x {if $active_modules.Egoods and $product.distribution}1<input type="hidden"{else}<input type="text" size="3"{/if} name="productindexes[{$product.cartid}]" value="{$product.amount}" /> = </span>*}


On a side note, putting {*} around Line 134 in the cart.tpl hides the "Estimate shipping" link in the Cart.

Code:

{*{include file="customer/main/shipping_estimator.tpl"}*}

minfinger 11-14-2011 11:59 AM

Re: Remove Quantity on Details Page
 
1 Attachment(s)
So I did a little more playing around with another site I have.

In the following code, notice I perform an if/then/else on the $product.productid eq 90. 90 is the Product ID for Party Deposit and it hides the multiplier options for just the Party Deposit. (see attachment) I've been trying to figure this out for MONTHS! Oh well...Done now.

Code:

                    <span class="product-price-text">
                      {if $product.productid eq '90'}
                      {else}
                      {currency value=$price} x {if $active_modules.Egoods and $product.distribution}1<input type="hidden"{else}<input type="text" size="3"{/if} name="productindexes[{$product.cartid}]" value="{$product.amount}" /> = </span>
                      {/if}


minfinger 11-14-2011 12:22 PM

Re: Remove Quantity on Details Page
 
Remove the quantity Modifier from the Mini Cart was my next goal, so here it is.
Open the /common_files/customer/minicart.tpl file.

On line 54 put a {* at the begin of that line and on line 67 put *} after the "=" sign.

In order to turn this off on a per product basis, use the following code and change as needed. Starting at line 52:
Notice the use of the Does Not Equal "!=".
Code:

            {else}
              {if $product.productid != '90'}
              {if $active_modules.Egoods and $product.distribution}

                <span class="quantity">
                  1
                  <input type="hidden" name="productindexes[{$product.cartid}]" value="1" />
                </span>

              {else}

                <input type="text" name="productindexes[{$product.cartid}]" value="{$product.amount}" class="quantity" />
              {/if}
              x
              <span class="price">{currency value=$price}</span>
              =
              {else}
              <span class="total">{multi x=$price y=$product.amount assign=unformatted}{currency value=$unformatted}</span>
              {/if}
             
            {/if}



All times are GMT -8. The time now is 02:59 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.