WordPress.org

Ready to get started?Download WordPress

Forums

Amazon Product in a Post Plugin
Out of Stock where price should be (22 posts)

  1. Fonsworthe
    Member
    Posted 7 months ago #

    I've started listing products on my site and where the price should be they say out of stock. The amazon items are not out of stock though. Does anyone know what I can do to fix this? Thanks in advance.

    http://wordpress.org/plugins/amazon-product-in-a-post-plugin/

  2. prophecy2040
    Member
    Plugin Author

    Posted 7 months ago #

    can you give me a link to an example please?

  3. Fonsworthe
    Member
    Posted 7 months ago #

    The wordpress is not live as I'm just starting to build the site. Where new and use is there is an "Out of Stock" where the price should be listed.

  4. Fonsworthe
    Member
    Posted 7 months ago #

    Is there a way to copy a or get a code that might help figure out what is wrong since it isn't launched?

  5. prophecy2040
    Member
    Plugin Author

    Posted 7 months ago #

    You could tell me the locale you are using and the ASINs for the products you are having a problem with. The locale would be .com, .co.uk, etc.

    Regards,
    Don

  6. Fonsworthe
    Member
    Posted 7 months ago #

    Hey Don,

    Sorry its taken a minute to get back to you. Two listed below say out of stock as well as others.
    B00CB3PVOE
    B00CKWQHN0

    This is the only one that seems to work
    B00876T7DU

    Is there maybe a way to just display the price and override the "Out of Stock" information? Just thinking of alternatives if this is something that can't be fixed.

    Thanks

  7. Fonsworthe
    Member
    Posted 7 months ago #

    I would also like to mention the reason it may being do this is because there are different sizes to pick from.

  8. TR7P
    Member
    Posted 6 months ago #

    Why didn't my reply show up here? I have the same problem. The only thing that shows up is the item image. Does anyone know how to fix this problem..

  9. Why didn't my reply show up here?

    Spam filter. We get lots of spam on these forums.

  10. TR7P
    Member
    Posted 6 months ago #

    Hi, got mine to work when using shortcodes instead of using the "New amazon post" option.

    Try this shortcode: [AMAZONPRODUCTS asin="B0084IG8TM" features="0" locale="com"]

  11. TR7P
    Member
    Posted 6 months ago #

    Spoke too soon. Now it doesn't work.. And trying to use a different Amazon buy it now button by using short code doesn't work either. Tried so many different variations. About to call it a day with this plug-in.

  12. design_dolphin
    Member
    Posted 6 months ago #

    Hi,

    Experiencing the same problem for some items.

    Looking at the database table 'amazoncache' one can see that for these items the attributes information is not stored in the database. However according to aws_signed_request.php it does have the code to look up things.

    Then looked at the XML feed through the Product Advertising Scratch Pad (http://associates-amazon.s3.amazonaws.com/scratchpad/index.html) to see if the XML feed ResponseGroup 'Attributes' contained the info. The 'Attributes' in the original feed didn't have the information either.

    The Responsegroup 'Variations' does have the information. This possibly to account for prize variations between different size and colors.

    From what I gather from aws_signed_request.php the 'Variations' Responsegroup needs to be also loaded for this change to work? That's what I've been able to figure out so far, I could be wrong though?

    function GetAPPIPReturnValArray($Item,$Errors){
     	//processor function for product created by Don Fischer http://www.fischercreativemedia.com
        $ItemAttr 									= isset($Item['ItemAttributes']) ? $Item['ItemAttributes'] : array();
        $ItemOffSum 								= isset($Item['OfferSummary']) ? $Item['OfferSummary'] : array();
        $ItemOffers 								= isset($Item['Offers']) ? $Item['Offers'] : array();
        $ItemAmazOffers								= isset($Item['Offers']) ? $Item['Offers'] : array();
      	$ImageSM									= isset($Item['SmallImage']['URL']) ? $Item['SmallImage']['URL'] : '';
      	$ImageMD 									= isset($Item['MediumImage']['URL']) ? $Item['MediumImage']['URL'] : '';
      	$ImageLG 									= isset($Item['LargeImage']['URL']) ? $Item['LargeImage']['URL'] : '';
      	$ImageSets									= isset($Item['ImageSets']['ImageSet']) ? $Item['ImageSets']['ImageSet'] : '';
    	$DetailPageURL 								= isset($Item['DetailPageURL']) ? $Item['DetailPageURL'] : array();
        $ASIN 										= isset($Item['ASIN']) ? $Item['ASIN'] : array();
        $ItemRev									= isset($Item['CustomerReviews']) ? $Item['CustomerReviews'] : array();
    	$DescriptionAmz								= isset($Item["EditorialReviews"]["EditorialReview"]) ? $Item["EditorialReviews"]["EditorialReview"] : array();
    	$cached										= isset($Item["CachedAPPIP"]) ? $Item["CachedAPPIP"] : 0;

    Hope it helps somewhat in finding a resolution to this problem.

  13. design_dolphin
    Member
    Posted 6 months ago #

    Question if I may:

    Where (and how) is the ResponseGroup set? I can't seem to find the variable to load it.

    Tried to add $Item['Variations'] to the function GetAPPIPReturnValArray in aws_signed_request.php to see if that would return the ResponseGroup 'Variations', however that gets me a NULL result. It will only return certain ResponseGroups such as 'ItemAttributes' within the function. All I get is ResponseGroup 'Large' when I do a var_dump in appip_get_XML_structure in aws_signed_request.php

    From what I read the 'Large' ResponseGroup shouldn't be used though (and doesn't contain the 'Variations' ResponseGroup, which could possibly explain why it can't be called?):

    "The Large response group returns a great deal of information about items in the response. The Large response group is for demonstration purpose and is not suitable for production applications. Precise required response groups should always be used in applications to reduce latency and response size."

    See response group 'Large" in the AWS Documentation Product Advertising API on Response groups: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_ResponseGroupsList.html

  14. prophecy2040
    Member
    Plugin Author

    Posted 6 months ago #

    @design_dolphin & all -
    A few things:

    1. The documentation about the Large Response Group not being used in production because it is too large, is a bit out of date. Other response groups (like Variations for example) can return 3-4 times more data than the Large group.
    2. The reason we chose the Large Response group for the plugin is that there are a lot of elements that users want in the display - and the Large group has almost everything we need (except in those cases where variations may be present).
    3. We are working on the next release (still) but have it in testing now. It has the VariationSummary response group as part of the request. In the event, you need something else, there will be a filter that allows you to add to it.
    4. Lastly - if you are looking for the place where the response group is located, it is not in the aws_signed_request.php, but in the amazon-product-in-a-post-functions.php when the request happens (in the getSingleAmazonProduct function there is a variable called $appip_responsegroup).

    We do have the version available to test if you want to test it out:
    Version 3.5.3 beta.

    Hopefully this helps everyone out.
    Warm regards,
    Don

  15. design_dolphin
    Member
    Posted 6 months ago #

    It definitely helps me. Thank you.

    Testing the Beta version:

    In all below variations of $appip_responsegroup the list price and sale price are the same if the item is not on sale (needs an if the price is the same then don't show?). If the item is on sale, the correct list and sale price shows. This through the 'Amazon Product ASIN (ISBN-10)' interface in the post screen.

    $appip_responsegroup 	= apply_filters('getSingleAmazonProduct_response_group',"Large,Reviews,VariationSummary");

    (in amazon-product-in-a-post-function.php)

    Didn't give access to one of the variation responsegroups when added.
    When the Large Responsegroup is set it may override some of the Variations response groups?

    Changing it to:

    $appip_responsegroup            = apply_filters('getSingleAmazonProduct_response_group',"ItemAttributes,Images,VariationImages, VariationMatrix, VariationSummary");

    or

    $appip_responsegroup            = apply_filters('getSingleAmazonProduct_response_group',"ItemAttributes,Images,Variations");

    Loaded the XML that I was looking for. I'm not sure if it works with (all) shortcodes, but I can work around that.

    @prophecy2040
    If you need/ want some help in the future to flesh out the shortcodes for the variations feel free to contact me, and I'll see what I can do.

  16. prophecy2040
    Member
    Plugin Author

    Posted 6 months ago #

    VariationSummary is just a summary of the variation pricing. If you add the Variations or others that you mention, you get all of the Variations (which is a LOT of data and adds additional response when calling the API). I would recommend just using the summary if you can. I would probably not add all the extra to the plugin because it is WAY more information than most users need and the added return time will slow down page loads a bit.

    That is why we added the filters - so a user could add them if they wanted to for their version. So you would do something like this in your functions.php file:

    add_filter('getSingleAmazonProduct_response_group','add_my_own_response_group');
    function add_my_own_response_group($rgroups){
       return $rgroups.',VariationImages, VariationMatrix';
    }

    As for accessing the variables - we added a new processing object function to this version that has all returned variables. This version makes use of a few items in this new array, but they will be used in the next version to replace the existing array and make the plugin more dynamic and filterable. If you look at line 88 of amazon-product-in-a-post-functions.php file, you can print out the new object and see all variables.

    We need to get this version out sooner than later because it fixes a few flaws in the 3.5.2 version and people are waiting for it. In the next version, we will address most of your concerns about the Variable pricing. Note that you CAN turn off the list price in both the shortcode and the single product (single product has a checkbox to remove the list price, shortcode has a variable). So when that is an issue, I would suggest just turning it off.

    AND one last thing that is worth noting for those who read this post and try to fix their version of the plugin using anything in this post - DO NOT MODIFY THE PLUGIN CODE AT ALL - if you do, when the plugin updates you WILL lose all modifications as it is overwritten. Always try to use filters and hooks in your functions.phptheme file (or child theme file is relevant) - it will save you a lot of time and frustration.

    Warm regards,
    Don

  17. design_dolphin
    Member
    Posted 6 months ago #

    Thank you. Was working on a converter that would load the XML data from the database and then convert this to an array. The fact that this is already implemented saves me time.

    Quite understandable that you have a release path. The plugin looks beautiful as is, and the beta looks even more impressive. Nice work.

    Proceeded with a two-fold approach to solve the sale price listing incorrectly.

    From what I can tell the 'Variations' responsegroup contains the sale prices for the variations. The other variations responsegroups don't. So, I will have to use the variations table.

    1. It could be nice for a future iteration of the plugin to have an add_filter to replace all the standard groups in the plugin with custom groups. It may allow to overcome the price quirk if this is why the price problem is occuring for some categories.

    Something like this (although there may be better ways of doing this):

    In functions.php

    add_filter('getSingleAmazonProduct_response_group','use_my_own_response_group');
    function use_my_own_response_group($rgroups){
        $rgroups = "ItemAttributes,Images,Variations";
        return $rgroups;
    }
    
    /*
    add_filter('getSingleAmazonProduct_response_group','add_my_own_response_group');
    function add_my_own_response_group($rgroups){
       return $rgroups.',VariationImages, VariationMatrix';
    }
    */

    Then in amazon-product-in-a-post-functions:

    $rgroups = "Large,Reviews,VariationSummary";
    $appip_responsegroup = apply_filters('getSingleAmazonProduct_response_group', $rgroups);

    2.The following snippet solves the price issue with custom code for purpose made templates. Please keep in mind this is all alfa code and should not be used on a production site, and it won't work with the plugin interface or shortcodes, it is just code that runs. .

    Using the variations table was able to get the sale price for each variation using the following proof of concept code. It is intended to list the different attributes by color (alfa stage and still buggy).

    $i = 0;
    $total_variations = $resultarr2[0]->Variations_TotalVariations;
    while($i <= $total_variations)
        {
            $i++;
            $variation_size = 'Variations_Item_' . $i . '_ItemAttributes_Size';
            $variation_color = 'Variations_Item_' . $i . '_ItemAttributes_Color';
            $variation_list_price = 'Variations_Item_' . $i . '_ItemAttributes_ListPrice_FormattedPrice';
            $variation_sale_price = 'Variations_Item_' . $i . '_Offers_Offer_OfferListing_Price_FormattedPrice';
            // Available sizes by color
            $variation_array['available_color-' . $resultarr2[0]->$variation_color]['available_size-' . $i] = $resultarr2[0]->$variation_size;
            // List Price by color
            $variation_array['available_color-' . $resultarr2[0]->$variation_color]['list_price-' . $i] = $resultarr2[0]->$variation_list_price;
            // Sale Price color
            $variation_array['available_color-' . $resultarr2[0]->$variation_color]['sale_price-' . $i] = $resultarr2[0]->$variation_sale_price;
        }
    unset($i);
    print_r($variation_array);

    This solves the problem I was running up against. The code still needs improving, but it is a possible approach to fix the problem, but at least now know where the problem was occuring for me. When I get all the bugs ironed out my intention is to publish the finished code here if helps (or the plugin may already solve it by then).

    Hope it helps.

  18. prophecy2040
    Member
    Plugin Author

    Posted 6 months ago #

    @design_dolphin
    Thanks for the feedback -
    on your number 1 above:

    It could be nice for a future iteration of the plugin to have an add_filter to replace all the standard groups in the plugin with custom groups. It may allow to overcome the price quirk if this is why the price problem is occuring for some categories.

    This is already in the beta you have. The example filer I used just adds to it, but the point of the filter is that you CAN change or filter the response groups - like so:

    add_filter('getSingleAmazonProduct_response_group','add_my_own_response_group');
    function add_my_own_response_group($rgroups){
       $yournewgroups = '[PUT YOURS HERE]';
       return $yournewgroups ;
    }

    That will be in place in 3.5.3 when it goes to production.

    On number 2. That would be great. I will not be adding the variations to the plugin just yet (except as a 'between X and Y price used in the Variations Summary), as I think it is more than most people need. When developing a plugin, you have make sure it works for the masses and then address the exceptions when they happen. Having something for other to look at will make it easier if they need to do it themselves.

    The only thing I ask, is that you keep is as SIMPLE as possible. Most users of the plugin are not programmers and take everything in a post as truth, but in reality they may not understand how it will affect their site. Keep it simple, hook into the plugin whenever possible, explain your code and what it does (both positive and negative) and don't try to reinvent the wheel! Thanks again.

    Warm regards,

  19. design_dolphin
    Member
    Posted 6 months ago #

    There appears to be a possible workaround/ solution in the virgin beta plugin to solve this double pricing and out of stock quirk. This using the standard Responsegroups that come with the beta plugin, or using the add or replace Responsegroups filter in functions.php

    - Uncheck 'list price' in the post admin screen under 'Amazon Product in a Post' form.

    It will now show the 'starting at' or 'from' price and the stock message when there is no sale price. This instead of the crossed out list price with the sale price being the same. When there is a sale price it showed the sale price below the normal price, as well as the in stock message.

    This when ASIN is filled in 'Amazon Product ASIN (ISBN-10)', the 'Product is Active?' is checked, and the 'Hook into Content?' is checked, and 'Open Product Link in New Window?' is checked.

    Other options like 'Show Amazon Features?' seem to work with it as well. (Although there may be option settings that could cause conflict, that would need further testing.)

    Is that what you meant with?

    Note that you CAN turn off the list price in both the shortcode and the single product (single product has a checkbox to remove the list price, shortcode has a variable). So when that is an issue, I would suggest just turning it off.

    Haven't tested it with AMAZONPRODUCTS or amazon-elements yet.

    Hope it helps.

  20. design_dolphin
    Member
    Posted 6 months ago #

    Testing the possible workaround/ solution with:
    AMAZONPRODUCTS or amazon-elements

    Using the workaround for AMAZONPRODUCTS or amazon-elements tags doesn't work completely or not all.

    1. AMAZONPRODUCTS will show the lowest price only using:

    [AMAZONPRODUCTS asin="XXXXXXXXXX" listprice="0"]

    So while this solves the double pricing, it does not show sale and list price together when an item is on sale. When using the standard Responsegroups it would show an item in or out of stock correctly. When using the Responsegroups 'ItemAttributes,Images,Variations' it would show item as out of stock when it was in stock.

    2. The workaround doesn't seem to work with amazon-elements.

    Tested amazon-elements with:
    LowestNewPrice (shows 0 regardless whether an item is on sale or not)
    ListPrice (Shows list price only)
    new-price (Shows nothing).
    msg_instock="in stock" (Shows nothing)
    msg_outofstock="no more left!" (Shows nothing when in stock, which would be correct because it is in stock. Shows nothing when out of stock.)

    Both 1. and 2. using the standard Responsegroups that come with the beta plugin, or using the add or replace Responsegroups filter in functions.php

    While this may not provide a solution at the moment, I do hope it gives some data and does some testing to help solve the bug. Please double check as I may have missed something.

  21. prophecy2040
    Member
    Plugin Author

    Posted 6 months ago #

    @design_dolphin
    Thanks for pointing these out. Most have already been brought up by other testers, so we are working on a fix for the beta. The amazon-elements stock messages are a new bug, so we will add that to the fix list.

    Thanks for looking so thoroughly.
    Warmest regards,
    Don

  22. Fonsworthe
    Member
    Posted 1 week ago #

    Hey Don,

    My issue was never resolved as this thread kinda went off into other problems.

    Example
    http://dragonrings.net/2014/04/dragon-eye-ring/

    I think it may be because of sizing issues but have been unable to figure it out.

    Thanks

Reply

You must log in to post.

About this Plugin

About this Topic