Category Archive for "Computer"

How to hide product attributes with no value in Magento

As a working consultant on Magento Project I come across that different product type to have different product attributes. This means that every product will have more than 20 options and sometimes all option don’t apply to certain products. For instance a projector and laptop have different kind of product attributes like “Front Camera” in laptop is necessary to show as an product attribute, but into project it should not. Because the store uses the same attribute sets for each…

Read More

Change default sort order ASC to DESC for product listing in Magento

By default Magento shows products in category pages by ascending order. That’s why latest added product show at last in the Category. If we need to show latest added product at first in Category for this we should change default product order from ascending to descending. By changing direction we will able to show products as descending by its Name, Price and Position. For change order from Ascending to Descending: For this we need to update a little bit into…

Read More

Get last order of an customer magento

Here is the example code by which you can get last order details into mangento of using email id. $_customer = Mage::getModel('customer/customer'); $_customer->loadByEmail('demo@demo.com'); $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('customer_id', $_customer->getId()) ->addAttributeToSort('created_at', 'DESC') ->setPageSize(1); <strong>ID</strong> echo $orders->getFirstItem()->getId(); Shashi Dhar KumarShashi Dhar Kumar Experience in Web/software development including client server and implementation using PHP, XML, MySQL and SQL Server. Experience of working on Apache, Linux projects, Javascript, Ajax, Putty, FTP, Remote Connection, XML parsing, Mod-Rewriting, Payment Gateways and shipping modules, Trouble shooting and…

Read More

How to use WooCommerce’s default price at any custom template

To use WooCommerce’s price in your custom theme template open the template file and use the following code and see the magic. Example <?php global $post, $product; ?> <span itemprop=”price” class=”price”><?php echo $product->get_price_html(); ?></span> For default price template file of woocommerece you can look at folloiwng location yourtheme/woocommerce/loop/price.php. Open the file up and see the code used for the same <?php global $product; ?> <?php if ( $price_html = $product->get_price_html() ) : ?> <span class=”price”><?php echo $price_html; ?></span> <?php endif;…

Read More

How to use hooks (actions and filters) in wordpress and woocommerce

What are hooks? Hooks are helpful in WordPress which allow you to manipulate code without editing core files. It is used extensively used throughout WordPress and WooCommerce by developers. Two types of hook: actions and filters. Action Hooks allow you to insert custom code. Filter Hooks allow you to manipulate and return a variable. There are lot of excellent article on hooks and filters as follows: 1) https://codex.wordpress.org/Plugin_API 2) https://www.tipsandtricks-hq.com/wordpress-action-hooks-and-filter-hooks-an-introduction-4163 3) http://code.tutsplus.com/articles/the-beginners-guide-to-wordpress-actions-and-filters–wp-27373 4) http://blog.teamtreehouse.com/hooks-wordpress-actions-filters-examples Using hooks If you use a…

Read More

How to optimize files and images of website?

Optimizing Websites: Optimizing your website’s files is very important for better utilization of server resources. Even a high end server can fail to deliver the speed and performance that you look for, if the website is not optimized. Following are the steps to achieve this: Images: Always work and save your images with 72 dpi. More than this will not make any difference in quality of the picture as far as web is concerned. Save an image with text or…

Read More

Remove links from myaccount in magento

The easiest way to remove any link from the My Account panel in Magento is to first copy: app/design/frontend/base/default/template/customer/account/navigation.phtml to app/design/frontend/enterprise/YOURSITE/template/customer/account/navigation.phtml Open the file and fine this line, it should be around line 34: Right below it add this: <?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/ unset($_links['tags']); /* My Tags */ unset($_links['invitations']); /* My Invitations */ unset($_links['enterprise_customerbalance']); /* Store Credit */ unset($_links['OAuth Customer Tokens']); /* My Applications */ unset($_links['enterprise_reward']); /* Reward Points */…

Read More

How to get minimum and maximum price of Bundled Product in Magento?

I have problem to show the EMI price for particular product in bundled product in Magento. So I have tried to go through the google and found some interesting forum post to get the bundle product’s price. <?php $product_id = YOUR_PRODUCT_ID; $bundled_product = new Mage_Catalog_Model_Product(); $bundled_product->load($product_id); $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection( $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product ); $bundled_items = array(); foreach($selectionCollection as $option) { $bundled_prices[]=$option->getPrice(); } sort($bundled_prices); $minimum_price=$bundled_prices[0]; $maximum_price_tmp=array_slice($bundled_prices, -1, 1, false); $maximum_price=$maximum_price_tmp[0]; echo “Minimum Price:” . $minimum_price; echo “Maximum Price:” . $maximum_price; ?> Shashi…

Read More

How to move Magento site from subdomain to main domain?

Moving magento site from subdomain to main domain (and vice-versa) is quite easy. And you can do it by two different way and you will feel it is more easy when you go through how to do it. Process I: You need to do as per following steps to achieve this: STEP 1: Go to Magento Admin –> System –> Configurations –> Web –> Unsecure URL & Secure URL. Change both the secure URL and unsecure URL to the domain…

Read More

How to remove the short description from the products description page?

Please find the template file that is responsible for displaying a list of products on the page. This file can be here: app/design/frontend/base/default/template/catalog/product/list.phtml or app/design/frontend/default/[your theme]/template/catalog/product/list.phtml You will need to remove the following code: <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), ‘short_description’) ?> Or <div class=”short-description”><?php echo $_product->getShortDescription() ?></div> Alternatively you can hide the div using css by following way: search the class “short-description” into your theme css and add “display:none;” Shashi Dhar KumarShashi Dhar Kumar Experience in Web/software development including client server…

Read More