Explode a string using next line character in php

When we are dealing with import functionality or something like processing of data, We need to find a way to explode a string using next line character.
For that We can use php’s inbuilt functionality explode string and using EOL

Code is as shown below

<?php
 explode(PHP_EOL,$string)
 ?>

where $string is the string to be exploded
and PHP_EOL is the php end of line

Hope this on line of code will help you to explode a string using next line character.

Get product details from product id and name

In Magento eCommerce while working with catalog model, There arise the need to fetch product details from product id.
We can get all product details if we have product id.But sometimes we only have product name, so we need to get product id for getting product details.So here we are discussing about how we can get product details from product id and name

I am listing here both the method.
Continue reading

Get all shopping cart items and totals in magento

Here, We are discussing on how we can get all shopping cart items and totals in magento. It will be helpful in the cases if we need to show the informations regarding the cart and items somwhere in the website

So I will show you how you can get information about all items in your Magento Shopping Cart.

You will see how you can :-

– Get products id, name, price, quantity, etc. present in your cart.
– Get number of items in cart and total quantity in cart.
– Get base total price and grand total price of items in cart.
Continue reading