WordPress.org

Ready to get started?Download WordPress

Forums

Amazon Product in a Post Plugin
[resolved] amazon-product-table has inconsistent divs and classes (5 posts)

  1. jhoffman255
    Member
    Posted 10 months ago #

    Liking this plugin so far, though styling it has been a bit of a challenge. Using [AMAZONPRODUCTS...] vs [amazon-elements...] because, oddly, they don't return the same images! Within your 'amazon-product-table' you have divs with classes for each section (helpful) until the div enclosing the 'amazon-product-price' table, which is enclosed in a div with no class and deprecated 'align="left"' declaration.

    First request: Please remove the alignment declaration and give that enclosing div a class.

    Second request: Take the 'amazon-dates' div out of that table so that we can size and position it independently of the price grid.

    Thanks!

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

  2. prophecy2040
    Member
    Plugin Author

    Posted 10 months ago #

    jhoffman255,
    Thanks for the feedback.
    Just a little background:

    1. The basic table structure has been in place since the initial plugin was built (which was quite some time before it was released to the WP Repository). The layout worked well for a long time, but we realized it getting way out of date and changed the layout in the amazon-elements shortcode (the new shortcode) in the last release but did not get the updated layout in the old shortcode or post layout at that time. It will be updated soon, we promise. The plugin was never initially intended for mass usage and was built for one specific client at the time. The huge number of emails we received asking us how we were doing it, spawned the quick release of the first release of the plugin. In hind site, I wish I had spent a little more time and set it up with divs - but then again, the quality of the themes was not as good back then and the table layout was more universally stable to the mass of themes at the time.
    2. The second request will follow when we update the layout of the other items.

    We also plan to implement a layout helper in the near future, to help with styling and layout - and make it a bit more flexible.

    Again, thanks for the feedback.
    Warm regards,
    Don

  3. jhoffman255
    Member
    Posted 10 months ago #

    Thanks, Don. I will add that this is a great plug-in and I'm glad you released it! I would have rather used the new [amazon-element] shortcode as it does provide all the flexibility for formatting that I need except for the weird issue where Amazon returns a different image set (different URLs and images for some products) when you use the old [AMAZONPRODUCTS...] shortcode.

    Looking forward to the update and keep up the good work.

    Thanks,
    Joe

  4. prophecy2040
    Member
    Plugin Author

    Posted 10 months ago #

    Joe,
    Thanks for the compliments.
    If you want to use the new shortcode and the old image format, you can do it by adding some code to your functions.php file after the<?php opening tag:

    add_filter('amazon_product_in_a_post_plugin_elements_filter', 'fix_amazon_image',1);
    function fix_amazon_image($attr){
        if(!empty($attr)){
            global $apippnewwindowhtml;
            foreach($attr as $key => $product){
                if(isset($product['MediumImage'])){
                    if(isset($product['URL'])){
                        $attr[$key]['MediumImage'] = '<a href="'.$product['URL'].'" '.$apippnewwindowhtml.'><img src="'.$product['MediumImage'].'" class="amazon-image" alt="" /></a>';
                        unset($attr[$key]['URL']);
                    }else{
                        $attr[$key]['MediumImage'] = '<img src="'.$product['MediumImage'].'" class="amazon-image" alt="" />';
                    }
                }
            }
        }
        return $attr;
    }

    Then when you use the amazon-elements shortcode, use MediumImage for the image field, like so:

    [amazon-elements asin="0753515032" fields="title,MediumImage,URL,large-image-link,button"]

    That should solve the problem for you. Basically what it does is filter the new image and then call the old image function to get the correct image the old way it was done (which will stay in the plugin, so no worries about future use).
    Warm regards,
    Don

  5. jhoffman255
    Member
    Posted 10 months ago #

    This is perfect! Thank you. Thank you. Thank you!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.