Posts
Sanitize Phone no, if phone no length is more than 10 then, Remove 0, +91, 91 from phone no
- Get link
- X
- Other Apps
Sanitize Phone no, if phone no length is more than 10 then, Remove 0, +91, 91 from phone no. All Indian phone no's length is 10 digits including with STD code /** * Sanitize Phone no, if phone no length is more than 10 then */ function sanitizePhoneNo(phone){ if(phone.length >= 10) { if(phone[0] == 0) { phone = makePNo(phone, 1); }else if( (phone[0] == 9) && (phone[1] == 1) ){ phone = makePNo(phone, 2); }else if( (phone[0] == '+') && (phone[1] == 9) && (phone[2] == 1) ){ phone = makePNo(phone, 3); } } return phone; } function makePNo(val, cnt){ var a=''; for(var i=0; i<=(val.length)-1; i++){ if(i>=cnt){ a += val[i];} } return a; } /** * Validate Phone no with regular expression */ function validatePhoneNo(phone){ if( /^[0-9\ \-]+$/.test(phone)){ if(phone.length==10){return true;}else {return false;} }else {return false;} }
Lok Satta Videos: Lok Satta Leader Hyma With Kommineni Srinivas Rao ...
- Get link
- X
- Other Apps
MAGENTO, How to find Product Tax Rate OR Tax Percentage
- Get link
- X
- Other Apps
## MAGENTO, How to find Product tax rate foreach ($productIds as $productId) { $_product = Mage::getModel('catalog/product')->load($productId); $productsPrice = floatval($_product->getData("price")); // Get the product's tax class' ID $taxClassId = $_product->getData("tax_class_id"); echo 'Tax Class ID '.$taxClassId.' '; // Get the tax rates of each tax class in an associative array $taxClasses = Mage::helper("core")->jsonDecode( Mage::helper("tax")- >getAllRatesByProductClass() ); echo 'Tax Classes '.$taxClasses.' '; // Extract the tax rate from the array $taxRate = $taxClasses["value_".$taxClassId]; echo 'Tax Rate '.$taxRate.' '; } ?>
PHP Function to Create URLs
- Get link
- X
- Other Apps
$url = 'http://maheshbokkisam.blogspot.com/create_url.php'; $data = array("a"=>1, "b"=>3, "c"=>''); _make_url($url, $data); /** * Create url with url and uri * @param url and uri data (array) * return string (url) */ function _make_url($url='http://'.$_SERVER['SERVER_NAME'], $data){ $data = array_diff($data, array(''=>'')); // remove empty keys from uri data array return (count($data) > 0) ? $url.'?'.http_build_query($data, 'flags_') : $url; }
MAGENTO::Sales Order Grid Customization - Add SKU list and customer email column to the grid
- Get link
- X
- Other Apps
Add SKU list and Customer Email column to the grid Supposed you had copied your code\core\Mage\Adminhtml\Block\Sales\Order\Grid.php to code\local\Mage\Adminhtml\Block\Sales\Order\Grid.php because you want to display the subtotals, credit card types, total of items ordered for the sales order. The new version of Magento which is 1.4.1 in code\local\Mage\Adminhtml\Block\Sales\Order\Grid.php change like this protected function _prepareCollection() { $collection = Mage::getResourceModel($this->_getCollectionClass()); $collection->getSelect()->joinLeft( array('sfoi'=>'sales_flat_order_item'), 'main_table.entity_id=sfoi.order_id', array( 'sku' =>'sfoi.sku' ) ); $collection->addExpressionFieldToSelect ( "sku", "GROUP_CONCAT(sku SEPARATOR ' , ')", $fields="" ); $collection->getSelect()->group("entity_id"); $collection->getSelect()->join...