Magento 1 how to secure your server

Anyone who has been the owner of a eCommerce store knows that if you don’t take precautions getting hacked is a matter of when not if. In addition to any other steps you can find online here are a few more I have been doing lately.

We do offer hosting here at Towering Media and we have already taken these steps.

• Run a PCI complaint server.
• Stop listening to the FTP port on the computer. Instead connect over SFTP though the SSH port.
• Randomized your SSH port.
• Run CFS firewall
• Stop listening on your web disk port usually 2077
• Setup brute force protection
• Update your openSSL version
updating your OPENSSL through SSH

wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
  tar -xvzf openssl-1.0.1j.tar.gz
  cd openssl-1.0.1j
  ./config --prefix=/usr/
  make
  sudo make install

• Of course keep your magento installation updated
• Keep your blog software, forums, ticket systems etc. up to date.
Create a development site for WHM/Cpanel users make the development site in another cpanel account. Put a .htaccess password protection file on it. This way if you need to give our your FTP / Cpanel logins to third party developers that may be overseas they don’t have access to your live site. Ask them what files they made changes to and move those files to live yourself / or your trusted developer can do this.

How to add custom english verbiage for price label for specific customer group in magento

This is the php if statement that you would add to your view.php file for changing out the english verbiage that pulls the price label for a specific customer group, like wholesale as this rule is for. You would find this in your view.php file for the product page

<span class="price-label"><?php echo $_specialPriceStoreLabel</span>

and change it to this:

 <span class="price-label">
					
					
<?php $_isLoggedIn = $this->helper('customer')->isLoggedIn(); ?>

<?php $_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    if($_myGroupId == 2){
?>
  Wholesale Price
 <?php 
    }
    else
    {
    ?>
       <?php echo $_specialPriceStoreLabel ?><?php } ?></span>

How to display the quantity of products in stock on the Magento 1 front end product page

This is how you enable the display of the quantity of products in inventory on the front end product page.

Open /app/design/frontend/default/YOURTHEME/template/catalog/product/view.phtml

In there you can paste this code anywhere you would like the stock quantity to display:

<?php if ($_product->isAvailable()): ?>
    <p class="availability in-stock"><?php echo $this->__('Qty Available:') ?> <span><!--<?php echo $this->__('In stock') ?>--><?= (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?></span></p>
<?php else: ?>
    <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>

Magento category with products that have stock greater than 0

We had to modify the code we used for this Magento category with all products except out of stock products

Change this part

$inStockProductIds = array();

$inStockCollection = Mage::getModel(‘cataloginventory/stock’)
->getItemCollection()
->addFieldToFilter(‘is_in_stock’,
array( ‘eq’ => 1 )
)

To this

$inStockCollection = Mage::getModel('cataloginventory/stock')
    ->getItemCollection()
->addQtyFilter('>', 0)