Amazon Product API: Offers from Amazon missing - amazon-product-api

I am confused how the Amazon Product API works. For my example I used this ASIN (B00Y9S4V22) which is available in the german Amazon.
I requested the data from the API with the response Group "Large,OfferFull,Offers" and was confused because the only price it returns me is "1,80". On the Amazon Page itself it shows 2,37 (orderable with Prime).
As you can see in the response below it says that there are total 3 new (In the Summary in TotalNew) - which is correct. But in the Offer Listing I only have 1 of them - the cheapest. But my goal is to get the offer which is sold by Amazon it self / prime orderable / plus-product orderable. But these offers are missing completely.
When I open the "All Offers" link I get this result:
As you can see the amazon offer is listed there - but still missing in my response.
XML Response (I removed unnecessary properties)
<Items>
<Request>
<IsValid>True</IsValid>
<ItemLookupRequest>
<Condition>All</Condition>
<IdType>ASIN</IdType>
<ItemId>B00Y9S4V22</ItemId>
<ResponseGroup>Large</ResponseGroup>
<ResponseGroup>OfferFull</ResponseGroup>
<ResponseGroup>Offers</ResponseGroup>
<VariationPage>All</VariationPage>
</ItemLookupRequest>
</Request>
<Item>
<ASIN>B00Y9S4V22</ASIN>
<ParentASIN>B01HU1G8A2</ParentASIN>
<DetailPageURL>https://www.amazon.de/Westcott-00-Geodreieck-bruchsicher-transparent/dp/B00Y9S4V22?psc=1&SubscriptionId=AKIAJAD2WJOOQC6SJGWQ&tag=cheepah-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00Y9S4V22</DetailPageURL>
<SalesRank>832</SalesRank>
<ItemAttributes>
<ListPrice>
<Amount>237</Amount>
<CurrencyCode>EUR</CurrencyCode>
<FormattedPrice>EUR 2,37</FormattedPrice>
</ListPrice>
</ItemAttributes>
<OfferSummary>
<LowestNewPrice>
<Amount>180</Amount>
<CurrencyCode>EUR</CurrencyCode>
<FormattedPrice>EUR 1,80</FormattedPrice>
</LowestNewPrice>
<TotalNew>3</TotalNew>
<TotalUsed>0</TotalUsed>
<TotalCollectible>0</TotalCollectible>
<TotalRefurbished>0</TotalRefurbished>
</OfferSummary>
<Offers>
<TotalOffers>1</TotalOffers>
<TotalOfferPages>1</TotalOfferPages>
<MoreOffersUrl>https://www.amazon.de/gp/offer-listing/B00Y9S4V22?SubscriptionId=AKIAJAD2WJOOQC6SJGWQ&tag=cheepah-21&linkCode=xm2&camp=2025&creative=12738&creativeASIN=B00Y9S4V22</MoreOffersUrl>
<Offer>
<Merchant>
<Name>mane Büroshop</Name>
</Merchant>
<OfferAttributes>
<Condition>New</Condition>
</OfferAttributes>
<OfferListing>
<OfferListingId>47YkU0Y7wnSskg8Uv7WqMgMXIxp3CsbATIFxuhiVJN3WRBaDRBRVgDtK4OIpe%2ByOIQQubWu4jlopsbF3uBH2AeWqyOFDpEGOLh7X%2BPjKwYsRTKgA7vy12yfzZyVVIY%2F10%2BrPSNeI24F8fo9qxj%2FLCgUdrVCFhI2a</OfferListingId>
<Price>
<Amount>180</Amount>
<CurrencyCode>EUR</CurrencyCode>
<FormattedPrice>EUR 1,80</FormattedPrice>
</Price>
<AmountSaved>
<Amount>57</Amount>
<CurrencyCode>EUR</CurrencyCode>
<FormattedPrice>EUR 0,57</FormattedPrice>
</AmountSaved>
<PercentageSaved>24</PercentageSaved>
<Availability>Versandfertig in 1 - 2 Werktagen</Availability>
<AvailabilityAttributes>
<AvailabilityType>now</AvailabilityType>
<MinimumHours>24</MinimumHours>
<MaximumHours>48</MaximumHours>
</AvailabilityAttributes>
<IsEligibleForSuperSaverShipping>0</IsEligibleForSuperSaverShipping>
<IsEligibleForPrime>0</IsEligibleForPrime>
</OfferListing>
</Offer>
</Offers>
</Item>
</Items>
And here is the Request:
<Arguments>
<Argument Name="AWSAccessKeyId" Value="---"></Argument>
<Argument Name="AssociateTag" Value="---"></Argument>
<Argument Name="Condition" Value="All"></Argument>
<Argument Name="IdType" Value="ASIN"></Argument>
<Argument Name="ItemId" Value="B00Y9S4V22"></Argument>
<Argument Name="Operation" Value="ItemLookup"></Argument>
<Argument Name="ResponseGroup" Value="Large,OfferFull,Offers"></Argument>
<Argument Name="Service" Value="AWSECommerceService"></Argument>
<Argument Name="Timestamp" Value="2018-10-30T22:14:08.000Z"></Argument>
</Arguments>
I know that there is a "ListPrice" but as far as I understand Amazon this is not always the price which is Amazon is selling it.

For anyone else who is looking for a solution:
You can also provide the argument "MerchantId" and set it to "Amazon". I am still confused why not all Offers are listed but when setting the argument "MerchantId" the response will provide the Amazon Offer (but no offer else)

Related

Sales Order Export CSV in Magento2

How can we add new column with custom data in the “Order Export CSV” like discount amount, coupon code, Product Attributes?
I found solution by myself spend few hours on it. Below steps will clear solution.
1) Create New Column in below xml
vendor/magento/module-sales/view/adminhtml/ui_component/sales_order_grid.xml
<column name="custom_product_name" class="Magento\Sales\Ui\Component\Listing\Column\Price">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item>
<item name="visible" xsi:type="boolean">false</item>
<item name="label" xsi:type="string" translate="true">Custom Product Name</item>
</item>
</argument>
</column>
2) alter sales_order_grid table, (Using upgrade Schema)
ALTER TABLE `sales_order_grid` ADD `custom_product_name` VARCHAR( 255 ) NOT NULL ;
Note: column name of table and column name in XML should be same.
3) Run Observer after the place order. StackOverflow - Which observer to use after success order on Magento 2?
Important : DO NOT work in core files, you have to override all the files in your module.

Overwriting Templates with custom Module in Magento 2

I am trying to overwrite a template defined in /vendor/magento/module-grouped-product/view/frontend/layout/catalog_product_view_type_grouped.xml in a custom module. The file has a block named product.info.grouped defined like so:
<block class="Magento\GroupedProduct\Block\Product\View\Type\Grouped" name="product.info.grouped" before="product.info.addtocart" template="product/view/type/grouped.phtml"/>
So I created a file /app/code/FortyThree/GroupedConfigurableProduct/view/frontend/layout/catalog_product_view_type_grouped.xml and in it
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<referenceBlock name="product.info.grouped">
<action method="setTemplate">
<argument name="template" xsi:type="string">FortyThree_GroupedConfigurableProduct::product/view/type/grouped.phtml</argument>
</action>
</referenceBlock>
</layout>
and created the corresponding .phtml file but it doesn't overwrite the original template file. Is there something else I need to do to get the overwrite to register? I've tried setup:upgrade and flushing the cached nothing seems to work. I also have the Magento_GroupedProduct set in the sequence section of my module.xml to make sure its loading after.
It really doesn't seem like my catalog_product_view_type_grouped.xml is being read at all since nothing I do in there seems to do matter.
You layout file isn't good.
This should do the trick :
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.grouped">
<action method="setTemplate">
<argument name="template" xsi:type="string">FortyThree_GroupedConfigurableProduct::product/view/type/grouped.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
Also don't forget to add a dependency to GroupedProduct in your module.
There are a few ways to check if you are referencing properly a block. You could simply use a remove, to see if that works to confirm that you have the proper block.

Magento 2 : Display multiple grids in admin area

I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml file.
Here is my di.xml which I have created for my first grid :
app/code/Ved/Mymodule/etc/di.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="Ved\Mymodule\Model\ResourceModel\News\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">ved_zipcodes</argument> <!-- here ved_zipcodes this is the db table name -->
<argument name="resourceModel" xsi:type="string">Ved\Mymodule\Model\ResourceModel\News</argument> <!-- Path -->
</arguments>
</virtualType>
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<!-- Here name value, we will use in mymodule_my_grid.xml layout file -->
<item name="mymodule_news_grid_data_source" xsi:type="string">Ved\Mymodule\Model\ResourceModel\News\Collection</item> <!-- Collection path -->
</argument>
</arguments>
</type>
</config>
How should I update my di.xml for displaying second grid in admin? <>br
Any help would be highly appreciated. Thank you.

Magento 2 - How to change htmlClass, htmlId attributes by referenceContainer or another way?

In magento 2 Frontend developer guide, I have read that :
Certain attributes, like htmlClass, htmlId, label attributes can be
changed in extending layouts
I want to change htmlClass of the container defined in 1column.xml. Could you tell me how to do it by referenceContainer or another way ?
I used : (both html_class & htmlClass)
<arguments>
<argument name="html_class" xsi:type="string">sm-page-header</argument>
</arguments>
but not affected
Thanks!
If a container is declared in xml with the following code:
<container name="my.container" htmlTag="div" htmlClass="old-class">
<...>
</container>
You can simply override the css-class by placing the following code somewhere in your extending layout files:
<referenceContainer name="my.container" htmlClass="new-class" />
EDITED: Bellow does NOT work;
<referenceContainer name="my.name">
<arguments>
<argument name="html_tag" xsi:type="string"><![CDATA[]]</argument>
<argument name="html_class" xsi:type="string"><![CDATA[]]</argument>
<argument name="html_id" xsi:type="string"><![CDATA[]]</argument>
</arguments>
</referenceContainer>
For changing or adding new class/id you can use htmlClass and htmlId attributes in container (child of referenceContainer) instead using of referenceContainer.
Example:
1column.xml file path for custom theme
app/design/frontend/{Package}/{theme}/Magento_Theme/page_layout/1column.xml
<container name="footer-container" as="footer" before="before.body.end" htmlClass="page-footer another-class" htmlId="test-id" label="Page Footer Container" htmlTag="footer" />
for details please take a look in this built-in 1column.xml file.
vendor/magento/module-theme/view/frontend/page_layout/1column.xml

Lucene search in sitecore with 2 websites

I integrated lucene search in my sitecore website which has one more website under content item in the content tree. I added a new searchindex.config file in app_congif/include folder. I've also changed the lucenesearch source to get siteroot as
SiteRoot = database.GetItem("/sitecore/content");
But the search isn't working. It shows:
unable to find results item
which means it isn't getting anything in the /Standard_Items/Search_Results. This is my searchindex.config:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<database>
<database id="master">
<Engines.HistoryEngine.Storage>
<obj type="Sitecore.Data.$(database).$(database)HistoryStorage,Sitecore.Kernel">
<param connectionStringName="$(id)"/>
<EntryLifeTime>30.00:00:00</EntryLifeTime>
</obj>
</Engines.HistoryEngine.Storage> <Engines.HistoryEngine.SaveDotNetCallStack>false</Engines.HistoryEngine.SaveDotNetCallStack>
</database>
</database>
<search>
<configuration>
<indexes>
<index id="SearchIndex" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">search_index</param>
<Analyzer ref="search/analyzer"/>
<locations hint="list:AddCrawler">
<resources type="Sitecore.Search.Crawlers.DatabaseCrawler, Sitecore.Kernel">
<Database>master</Database>
<Root>/sitecore/content</Root>
<include hint="list:IncludeTemplate">
<template>{2A609D52-7B9F-49F3-83BE-047FD16397A7} </template>
<template>{F98712D8-27DB-4324-82E6-65242F0977F9} </template>
<template>{849CA304-3F51-4FCB-B9B3-2AC7E950B476} </template>
<template>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523} </template>
<template>{52BDB3C4-0585-437C-89AD-6AAC81950633} </template>
</include>
<IndexAllFields>true</IndexAllFields>
<Boost>2.0</Boost>
</resources>
</locations>
</index>
</indexes>
</configuration>
</search>
</sitecore>
</configuration>
here is my content tree. I want to search in sitecore/content/DruBlue.
Can anyone please help me ?
You have an error in your configuration:
<include hint="list:IncludeTemplate">
<template>{2A609D52-7B9F-49F3-83BE-047FD16397A7} </template>
<template>{F98712D8-27DB-4324-82E6-65242F0977F9} </template>
<template>{849CA304-3F51-4FCB-B9B3-2AC7E950B476} </template>
<template>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523} </template>
<template>{52BDB3C4-0585-437C-89AD-6AAC81950633} </template>
</include>
This part will only include the {52BDB3C4-0585-437C-89AD-6AAC81950633} template as all they have the same tag name. You need to use different tags for each of them (doesn't matter if you use template1, template2 ... or news, article, event, e.g.:
<include hint="list:IncludeTemplate">
<template1>{2A609D52-7B9F-49F3-83BE-047FD16397A7}</template1>
<template2>{F98712D8-27DB-4324-82E6-65242F0977F9}</template2>
<article>{849CA304-3F51-4FCB-B9B3-2AC7E950B476}</article>
<news>{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}</news>
<event>{52BDB3C4-0585-437C-89AD-6AAC81950633}</event>
</include>
See Sitecore search and indexing pdf for more details.
Then you should rebuild the index (you can do this from Sitecore Desktop > Control Panel > Database > Rebuild the Search index. When reindexing is done try to confirm that there are any items in the index. You can use
Sitecore index viewer module or standalone Luke - Lucene Index Toolbox.
Here you can find more information about solving Sitecore and Lucene problems.

Resources