Tuesday, 15 January 2019

How to get instagram feed in custom page in magento

<?php
$fields = array(
'client_id' => "bdb4fd62e6e24f938fb7d124acf80187",
'client_secret' => "1cca64ded0e046118b311fdc001bb52c",
'grant_type' => "authorization_code",
'redirect_uri' => "http://wgi-mobile-dev-949798541.ap-south-1.elb.amazonaws.com/insta.php",
//'code' => $_GET['code'],
);
//1484074220.1677ed0.af32987ae8984bb59d9803afabc83e65
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.instagram.com/v1/users/self/media/recent/?access_token=1484074220.1677ed0.af32987ae8984bb59d9803afabc83e65');
curl_setopt($ch, CURLOPT_POST, false);
//curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$posts = curl_exec($ch);
curl_close($ch);
$posts = json_decode($posts);

if ($posts) {
foreach ($posts->data as $dat) {
echo '<img src="' . $dat->images->standard_resolution->url . '" style="width:250px;height:200px;">';
}
}
?>

instagram access token generator :- https://instagram.pixelunion.net/

Thursday, 29 November 2018

How do Delete wishlist item in magento 1.9 by programatically?

  $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($userId);
            $wishListItemCollection = $wishList->getItemCollection();
            foreach ($wishListItemCollection as $item) {
               $w_product_id = $item->getProductId();
                if ($w_product_id==$product_id) {
                    $item->delete();
                   
                    echo 'Deleted successfully';
                }else{
                    echo 'Not Deleted';

                }

How do List to wishlist item in magento 1.9 by programatically?

$itemCollection = Mage::getModel('wishlist/item')->getCollection()->addCustomerIdFilter($customarId);
 foreach($itemCollection as $product) {
                   
                    $product_id = $product->getId(),
                   
                 
                
            }

Wednesday, 28 November 2018

How do I add to wishlist in magento 1.9 by programatically?

$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true);
$product = Mage::getModel('catalog/product')->load($productId);

$buyRequest = new Varien_Object(array()); // any possible options that are configurable and you want to save with the product

$result = $wishlist->addNewItem($product, $buyRequest);
$wishlist->save();

Friday, 23 November 2018

How to get list billing address and list shipping address by customer id in magento 1.9

$customerId = 2;
$customer = Mage::getModel('customer/customer')->load($customerId);
$defaultBilling  = $customer->getDefaultBilling();
$defaultShipping = $customer->getDefaultShipping();

$allAddress = Mage::getModel('customer/address')->getCollection()->setCustomerFilter($customer);

foreach ($allAddress as $address) {
    if($defaultBilling == $address->getId()) {
        // its customer default billing address
    } else if($defaultShipping == $address->getId()) {
        // its customer default shipping address
    } else {
        // its customer other address that saved
    }
}

Saturday, 27 October 2018

How to remove +/- symbol off the price in Magento 1.9 product custom option


 app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php and edited the line number 127

$priceStr = $sign;

to look like this:

$priceStr = '';

Magento 1.9 product Custom Options - make every first radio button checked

<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function(){

    $j('.options-list input.radio:first').attr('checked','checked');
    opConfig.reloadPrice();
});
</script>