Tuesday, 20 May 2014

Get current product data in custom file in magento

HI in some project i need to develop a module through which i need to insert a newly created product attribute  on product page with the modue xml file . For that i need to havethe current product data in my module file.

for that i have use the below function

$product_id = Mage::registry('current_product')->getId(); 
 
with this when your file will include in the porduct view page.it will load
 product id from your file.You can get any value from this.

Tuesday, 13 May 2014

How to check url contains http or htttps in php

Hi with the following code you can get the protocol of the server  
 
 
 
if (isset($_SERVER['HTTPS']) &&
    ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
    isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
    $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $protocol = 'https://';
}
else {
  $protocol = 'http://';
}