Month: March 2015

magento

detect ip for switch website or websotre

<?php $client_ip=$_SERVER; $json=file_get_contents("http://ipinfo.io/{$client_ip}/json"); $details = json_decode($json); var_dump($details->country); $country=$details->country; switch ($country) { case "CA": case "MX": case "US": $_SERVER = "usd"; $_SERVER = "website"; break; default: $_SERVER = "row"; $_SERVER = "store"; } Mage::run($_SERVER, $_SERVER); ?>

MY PROJET

check etiquette perdu script

$p_simple = DB::table('product_simple')->get(); foreach ($p_simple as $s) { $sku = $s->sku; $etiquette = $s->etiquette; $update_p = (array)DB::table('db_update')->where('sku', $s->sku)->get(); $new_label = ""; $new_label_arr = explode(',', $etiquette); $lost_label = array(); $exit_label=array(); foreach ($update_p as $u) { if ($u->qty === null && $u->etiquette...

magento

get Module url

Parameter 1 - $routePath The route path follows the Zend behaviour of “module/controller/action”. The module part is self-explanatory. For example “cms” resolves to Mage_Cms. The controller is the class that will handle the address. “cms/page” refers to the class Mage_Cms_PageController....

magento

add image to mangento

$product->addImageToMediaGallery('ABSOLUTE_PATH','image',true,false); select all This snippet will add an image residing in ABSOLUTE_PATH to product, assign it to “image” attribute, move it from original location (true), and uncheck the “Exclude” option (false). Here’s Magento documentation on the method: void addImageToMediaGallery (string...