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

Hiding product weights and inventory quantities

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 03-13-2016, 09:04 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Hiding product weights and inventory quantities

The weight is displayed by this template file:
skins/default/en/shopping_cart/parts/item.info.weight.tpl

If you check the file, it has the @ListChild directive that says that the template must be shown in the "cart.item.info" list. So, to removing the template from that list should be enough to hide the weight in the shopping cart.

I haven't tested the following code, but creating a custom module and adding the following method to your Main.php (or doing the same for Custom Skin module) should work:
PHP Code:
protected static function moveTemplatesInLists()
    {
        return array(
            
'shopping_cart/parts/item.info.weight.tpl' => array(
                static::
TO_DELETE => array(
                    array(
'cart.item.info', \XLite\Model\ViewList::INTERFACE_CUSTOMER)
                ),
            ),
        );
    } 
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #12  
Old 03-14-2016, 08:59 PM
 
kevinrm kevinrm is offline
 

X-Wizard
  
Join Date: Aug 2003
Posts: 1,003
 

Default Re: Hiding product weights and inventory quantities

This is how I hide stock quantities - I don't want my competitors knowing how much inventory I keep.

1) Look&Feel>>Webmaster mode

2) Edit Template: /default/en/product/details/stock/body.tpl

Comment out the quantity tag using {** *} here is the template:
================================================

{* vim: set ts=2 sw=2 sts=2 et: *}

{**
* Product stock
*
* @author Qualiteam software Ltd <info@x-cart.com>
* @copyright Copyright (c) 2011-2015 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
* @license http://www.x-cart.com/license-agreement.html X-Cart 5 License Agreement
* @link http://www.x-cart.com/
*}

<div class="product-stock {getFingerprint()}">
{if:isInStock()}
<span class="stock-level product-in-stock">
<span class="in-stock-label">{t(#In stock#)}</span>


{**
<span class="product-items-available">({t(#X items available#,_ARRAY_(#count#^getAvailableAmount()))} )</span>
*}


</span>
{else:}
{if:isOutOfStock()}
<span class="stock-level product-out-of-stock">{getOutOfStockMessage()}</span>
{end:}
{end:}
</div>
__________________
X-Cart 5.4.1.39 Live
PHP 7.4.33
5.5.5-10.3.38-MariaDB MariaDB
Apache 2.4
CENTOS 7.8 64Bit Single Quad-Core E3-1241v3 3.4Ghz 8M 1600 w/ HT
32GB RAM 2x 512GB Samsung 850 Pro SSD RAID 1
Reply With Quote
  #13  
Old 11-06-2017, 08:17 AM
 
CorpWest CorpWest is offline
 

Newbie
  
Join Date: Oct 2017
Location: Silicon Valley, California
Posts: 3
 

Default Re: Hiding product weights and inventory quantities

What about hiding JUST the weight and keeping the SKU?
Would this work?
.product-details .extra-fields { display: weight; }
__________________
x-cart v5.3.3.4
Shared Linux server
we specialize in hosting for non-profits
no special modules added - trying to see how vanilla works first
Reply With Quote
  #14  
Old 11-09-2017, 01:11 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Hiding product weights and inventory quantities

Quote:
Originally Posted by CorpWest
What about hiding JUST the weight and keeping the SKU?
Would this work? .product-details .extra-fields { display: weight; }
If you use a custom module to provide your site changes, it's quite easy to then apply your "own version" of the relevant twig files, which in this thread's main discussion cases would be:

/skins/**your-custom-module**/customer/product/details/stock/body.twig for stock levels

/skins/**your-custom-module**/customer/product/details/common_attributes/common.product-attributes.weight.twig for weights

And if you needed to modify the sku display, that's here too:

/skins/**your-custom-module**/customer/product/details/common_attributes/common.product-attributes.sku.twig
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
  #15  
Old 11-09-2017, 03:37 AM
 
xim xim is offline
 

X-Cart team
  
Join Date: Nov 2004
Posts: 677
 

Default Re: Hiding product weights and inventory quantities

https://forum.x-cart.com/showpost.php?p=405434&postcount=2
__________________
Sincerely yours, Max Vydrin
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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:27 AM.

   

 
X-Cart forums © 2001-2020