Wednesday, 25 May 2016

Magento : Upgrading to Magento 2

Having had the opportunity to work on a new build using Magento 2 the architecture of the application has changed significantly, to me it has definitely increased the difficulty of getting a Magento project up and running but in return offers a more granular and organised application to work with.
With this view I think it’s unlikely that you would upgrade your site to v2. Magento have not given an upgrade path to 2.0 and I doubt they will, so it’s probably worth waiting for the opportunity to re-design the site before moving over to the new platform.
Magento have committed to 3 years from general release of 2.0 so that gives you till around 2019 to move over. In the meantime that means they will continue to provide security patches and support for the 1.x platform.

Tuesday, 17 May 2016

Magento : 404 page not found when trying to access CMS -> Pages in admin panel


Some leftover CMS-Page database entries were referencing a store_id of a store that no longer existed after I deleted it.

So here's what solved it for me:

Find out the ids of your stores: Under System > Manage Stores in the column Store View Name look for the Store's id that pop up when hovering the link and also in the link url
(e.g. ...admin/system_store/editStore/store_id/3/key/...)

To be safe, make a database backup under System > Tools > Backups

Go to your database and find the table cms_page_store. Delete all entries with a store id in the field store_id that points to a store, that does no longer exist.

Refresh CMS > Pages, 404 should be gone.

Monday, 16 May 2016

Magento : Default to the first item for all required options

Stick the code into 

app/design/frontend/default/theme/template/catalog/product/view/options.phtml

near the end of the file look for this line: 


var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);


and replace with this:


var opConfig = new Product.Options(<?php echo $this->getJsonConfig() ?>);Event.observe(window, 'load', function() {$$('.product-options select').each(function(element) {
element
.selectedIndex = 1;opConfig.reloadPrice();});});


Refresh cache and load a product on the frontend which has custom options - after the page loads an option should automatically be selected.

Magento : How to remove Custom Options +Price($10.00)



Using the comment from user "R.S" above I was able to fix this issue for my website. Here is a screenshot from my website showing the fix works






Find the file
/app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
Go to lines 70 - 74
Remove this code from line 72
. ' ' . $priceStr . ''
OR comment out the code
$_value->getTitle() /*. ' ' . $priceStr . ''*/,
be sure to leave the "," at the end of the statement. My code now looks like this and works fine.
$select->addOption(
              $_value->getOptionTypeId(),
                $_value->getTitle() /*. ' ' . $priceStr . ''*/,
                array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
            );
I hope this helps you and other who are looking for the same fix!

Saturday, 7 May 2016

Magento : Unknown cipher in list: TLSv1 [duplicate]




Go to downloader/lib/Mage/HTTP/Client/Curl.php,

            Edit Curl.php in notepad++ go line no. 377 or find

$this->curlOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1');

    to

$this->curlOption(CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);

Done! :)

Saturday, 23 April 2016

Magento : STOCK QUANTITY ON MAGENTO PRODUCT PAGE

Warning: This is a quick-n-dirty hack and will not work on all product types.

Instead of just showing the “in stock” and “out of stock” messages, we want to have an in-between message to show that stock levels are running low. This is easily done, by editing the following file:

app/design/frontend/base/default/template/catalog/product/view/type/default.phtml

We change the contents of the file to the following:

<?php
$_product = $this->getProduct();
$_quantity = intval(Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty());
?>

<?php if ($_product->isAvailable()): ?>
  <?php if ( intval($_quantity) < 10 ): ?>
    <p class="availability last-stock"><?php echo $this->__('Availability:') ?>
      <span><?php echo $this->__('Only '); echo $_quantity; echo $this->__(" left"); ?></span>
    </p>
  <?php else : ?>
    <p class="availability in-stock"><?php echo $this->__('Availability:') ?>
      <span><?php echo $this->__('In stock') ?></span>
    </p>
  <?php endif; ?>
<?php else: ?>
  <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?>
    <span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>

<?php echo $this->getChildHtml('product_type_data_extra') ?>
<?php echo $this->getPriceHtml($_product) ?>


That’s it!

We just created a warning-type level once stock drops to less than 10 items. Meanwhile, both the “in-stock” and “out-of-stock” messages are preserved. This can be easily styled using CSS. Note we added the class “last-stock” to our new p-tag

Magento : Disable/ Remove “Estimate Shipping and Tax”

We can solve this issue two way.
First way :
Create local.xml file with below code and upload your theme layout folder
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<layout>
<checkout_cart_index>
<reference name=”content”>
<block name=”checkout.cart”>
<remove name=”checkout.cart.shipping”/>
</block>
</reference>
</checkout_cart_index>
</layout>
Second way :
Remove the following code from /app/design/frontend/yourtheme/layout/checkout.xml
<block type=”checkout/cart_shipping” name=”checkout.cart.shipping” as=”shipping” template=”checkout/cart/shipping.phtml”/>
Done! :)