The Poetics Of Coding

Just add

<referenceBlock name="" remove="true"/>

at the end just before in default.xml

Over on our new server I was trying to make magmi password protected. Magmi directory was accessible before setting .htaccess password protection.
After that magento started showing 404 and on my site 404 was set to home page.

So there was 2 task, first we have to stop apache rewrite on this directory, second in case of authentication failier have to shown a 401 message or page.

ErrorDocument 401 “Unauthorized Access”
RewriteEngine off

After that your normal authentication code

AuthType Basic
AuthName “Administration”
AuthUserFile “/home/user/admin/.htpasswd/magmi/web/passwd”
require valid-user

Just make sure that path of AuthUserFile is correct and “passwd” file exists with user,pass information.

Hope it will give you some comfort 🙂

You have to edit src in embedded iframe, mostly we got code just like this

Just add “?title=0&byline=0&portrait=0″ at the end of src link
src will look like src=”; and whole embedded code will look like this

Amazon API documentation is good, but it’s really hard to understand the timestamp and signature things, it’s really takes all my time to understand how i can create signature for my request. There was no clear idea. Second thing is versions of it’s API, you couldn’t get idea what will work in which version.
Any how let’s check how we can show amazon’s product reviews on mangento product page.

1. First you have to get your API AWSAccessKeyId, AWSSecretKey
2. Create a custom attributes to enter ASIN number of the product, for which we will show reviews.
3. I am going to show reviews in reivew tab on product page.
Use the following code.

$product_id = $this->getProduct()->getId();
$_product = Mage::getModel('catalog/product')->load($product_id);
$product_asin = $_product->getData('asin');
	$AWSAccessKeyId   = "**************";
    $SecretAccessKey = "*****************";
    $AssociateTag    = "laptopbattery";

    $ItemId = $product_asin; //10 or 13 digit isbn
    $Timestamp = gmdate("Y-m-d\TH:i:s\Z");
    $Timestamp = str_replace(":", "%3A", $Timestamp);
    $ResponseGroup = "Reviews";
    $ResponseGroup = str_replace(",", "%2C", $ResponseGroup);

    $String = "AWSAccessKeyId=$AWSAccessKeyId&AssociateTag=$AssociateTag&IdType=ASIN&ItemId=$ItemId&Operation=ItemLookup&ResponseGroup=$ResponseGroup&Service=AWSECommerceService&Timestamp=$Timestamp&Version=2011-08-01";

    $String = str_replace("\n", "", $String);

    $Prepend = "GET\\n/onca/xml\n";
    $PrependString = $Prepend . $String;

    $Signature = base64_encode(hash_hmac("sha256", $PrependString, $SecretAccessKey, True));

    $Signature = str_replace("+", "%2B", $Signature);
    $Signature = str_replace("=", "%3D", $Signature);

    $BaseUrl = "";
   	$SignedRequest = $BaseUrl . $String . "&Signature=" . $Signature;

    $xml  = simplexml_load_file($SignedRequest);
	$iframurl = $xml->Items->Item->CustomerReviews->IFrameURL;
	echo '<iframe src="'.$iframurl.'" width="100%" style="border:0; height:1000px"></iframe>';



Mostly facing issues while installing magento2 are missing extensions.
and dreamhost will definitely give little tough time, but if you are well known with dreamhost it will not cost much
Below is the picture of my missing extension on dreamhost php5.6
magento2 extensions missing

so just login to your FTP and open “php” directory which should be on your top root.

dreamhost phprc

dreamhost phprc

just add missing extension in this file
always_populate_raw_post_data = -1

Now you have to give server a refresh, if you are familiar with SSH that is very good. otherwise simply restart server from your panel
after login to SSH (if you are on windows you can use putty for this connection, and your login users should be set as ca be login as ssh in your panel)
and run this command
killall -9 php56.cgi (for php 5.6)
killall -9 php55.cgi (for php 5.5)
that’s is now everything should work on the go.

Next error will be the MySql version “That’s the thing that Dreamhost can only be solve”. Magento 2 required MySql5.6.x and Dreamhost still runing 5.2.x

I really astonish after installing magento that a new installtion was showing so many errors,
beleive me i reinstall it that that may be i missed something, but the result was same, and when i googled for it, there was so many queries about these things,
some was out dated like run command ‘php bin/magento setup:static-content:deploy’ and there was no clue where i can run this, either in cmd as i am on windows and anywhere else.
Anyhow the trick worked for me is
open “di.xml” under “app\etc” and changed line

<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>


<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>

If you want to update price of magento whole catalog a SQL statement will be enough to run.
Tables involve are ‘catalog_product_entity_decimal’ containing product price value, msrp value etc
we also need to get price attribute id.

SELECT attribute_id FROM eav_attribute eav
WHERE eav.entity_type_id = 4 
AND eav.attribute_code = 'price'

Now let’s merge this query to price value update
NOTE::- Replace ‘new_price_value’ with your new price

UPDATE catalog_product_entity_decimal val
SET  val.value = 'new_price_value'
WHERE  val.attribute_id = (
     SELECT attribute_id FROM eav_attribute eav
     WHERE eav.entity_type_id = 4 
     AND eav.attribute_code = 'price'

Never run sql update query on live database directly, always test first on local or testing server.

%d bloggers like this: