How to add attributes to product grid or list view in category in Magento Commerce

How to add attributes to product grid or list view in category in Magento Commerce

There is actually a post on the Magento wiki that addresses how to add attributes to product grid or list view in category in Magento Commerce, but when we tried to do it, we came up with no results. After trying many different methods resulting in either no results or Magento error messages, we finally came up with this solution.

  1. First create your new attribute field in Magento Admin.
  2. Note what you name the new attribute field “code”. In our case, the attribute is names “freeshipping”.
  3. When you define this in the code side of Magento in the following steps, keep in mind you have to call it up with each word being capatalized, in this case it would be “FreeShipping”. (Don’t use the quotation marks I added unless you see them in the example code.)
  4. Open app/design/frontend/default/yourtheme/layout/catalog.xml
  5. Find the line that reads: <block type=”catalog/category_view” name=”category.products” template=”catalog/category/view.phtml”><block type=”catalog/product_list” name=”product_list” template=”catalog/product/list.phtml”><block type=”catalog/product_list_toolbar” name=”product_list_toolbar” template=”catalog/product/list/toolbar.phtml”>
  6. Change it to read something like this:<block type=”catalog/category_view” name=”category.products” template=”catalog/category/view.phtml”><block type=”catalog/product_list” name=”product_list” template=”catalog/product/list.phtml”><!–I added–><action method=”addAttribute”><name>FreeShipping</name></action><block type=”catalog/product_list_toolbar” name=”product_list_toolbar” template=”catalog/product/list/toolbar.phtml”>
  7. Next find the line in the same file that reads: <block type=”catalog/category_view” name=”category.products” template=”catalog/category/view.phtml”><block type=”catalog/product_list” name=”product_list” template=”catalog/product/list.phtml”><block type=”catalog/product_list_toolbar” name=”product_list_toolbar” template=”catalog/product/list/toolbar.phtml”>
  8. Change it to read something like:<block type=”catalog/category_view” name=”category.products” template=”catalog/category/view.phtml”><block type=”catalog/product_list” name=”product_list” template=”catalog/product/list.phtml”><!–kj added–><action method=”addAttribute”><name>FreeShipping</name></action><block type=”catalog/product_list_toolbar” name=”product_list_toolbar” template=”catalog/product/list/toolbar.phtml”>
  9. Save the file.
  10. Open app/design/frontend/default/yourtheme/template/catalog/product/list.phtml
  11. Insert a line of code like this where you want it to appear: <p><h4> <?php echo ($_product->getFreeshipping()) ?></h4></p><p><h4 class=”product-free-ship”> <?php echo ($_product->getFreeshipping()) ?></h4></p>
  12. You’ll need to do this twice, once for “List View” and once for “Grid View”
  13. Save the file.
  14. Refresh your Magento Cache. You should now see your new entries including your Magento attributes.

Problems Adding HTML Tables in Magento Commerce

If you’ve ever tried to add standard html into product descriptions or category descriptions in Magento, you’ll probably come up with a really long page with the table data spread out from top to bottom.

Here’s the solution we found:

This code comes from one of our websites, Summit Equipment, selling truck equipment. This particular product is a Warn DC2000 Electric Hoist. When adding the specs, we used this html table code: (This is a much shortened version here).

<tr>

<td><table width=”100%”>

<tr height=18px>

<td><b>Maximum Rated Load:&nbsp;</b>2000 lbs (907kg)</td>

</tr>

<tr height=18px>

<td><b>Maximum Wire Rope Recommended:&nbsp;</b>1/4″ 7000 lbs (3182kg) minimum breaking strength</td>

</tr>

It turns out, Magento does not like linebreaks. So, remove all your linebreaks, so now you have this spaghetti code:

<tr> <td><table width=”100%”><tr height=18px> <td><b>Maximum Rated Load:&nbsp;</b>2000 lbs (907kg)</td> </tr> <tr height=18px> <td><b>Maximum Wire Rope Recommended:&nbsp;</b>1/4″ 7000 lbs (3182kg) minimum breaking strength</td> </tr>

There you go. Your html table in Magento now displays properly!

Magento Charges Tax in California and New York

In case you’re using Magento Commerce and you’re not in California or New York, you may want to disable Magento from charging taxes in those states. By default, Magento Commerce charges tax in California and New York.

To disable, go to Magento Admin>>Sales>>Tax>>Manage Tax Zones and Rates.

You’ll see two tax zones. One for CA and one for NY. Select the one you want to delete and click the delete button.

There you go.

How To Change Order Status in Magento

I searched all around to find this solution. In Magento Commerce, there is no provision for manually changing order status from the admin panel. We use the “Ship” button in Magento to creating packing slips. We then process our order from that packing slip. This does not mean that the order is “Completed“, but according to the Magento Admin, the order is “Completed“. There is no way to change the status. When you try the drop down for “Status“, there is no choice other than “Completed“.

So here is the fix:

locate config.xml under Magento\app\code\core\Mage\Sales\etc\

Find this block of code:

<states>
<states> <new translate="label"> <label>New</label> <statuses> <pending/> </statuses> <visible_on_front/> </new> <pending_payment translate="label"> <label>Pending Payment</label> <statuses> <pending_paypal/> </statuses> </pending_payment> <processing translate="label"> <label>Processing</label> <statuses> <processing/> </statuses> <visible_on_front/> </processing> <complete translate="label"> <label>Complete</label> <statuses> <complete/> </statuses> <visible_on_front/> </complete> <closed translate="label"> <label>Closed</label> <statuses> <closed/> </statuses> <visible_on_front/> </closed> <canceled translate="label"> <label>Canceled</label> <statuses> <canceled/> </statuses> <visible_on_front/> </canceled> <holded translate="label"> <label>On Hold</label> <statuses> <holded/> </statuses> <visible_on_front/> </holded> </states>
Change it to this:
<states>
  <new translate="label">
    <label>New</label>
    <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </new>
  <pending translate="label">
    <label>Pending</label>
    <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </pending>
  <processing translate="label">
    <label>Processing</label>
    <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </processing>
  <complete translate="label">
    <label>Complete</label>
    <statuses>
      <complete/>
      <pending/>
      <processing/>
      <holded/>
      <closed/>
      <canceled/>
    </statuses>
  </complete>
  <closed translate="label">
    <label>Closed</label>
    <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </closed>
  <canceled translate="label">
    <label>Canceled</label>
    <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </canceled>
  <holded translate="label">
    <label>On Hold</label>
      <statuses>
      <pending/>
      <processing/>
      <holded/>
      <complete/>
      <closed/>
      <canceled/>
    </statuses>
  </holded>
</states>

Save the file.

Refresh your cache in Magento.

That should now allow you to manually change order status in Magento Commerce.