Plugin Directory

Changeset 1004924


Ignore:
Timestamp:
10/10/2014 07:42:29 AM (11 years ago)
Author:
2kblater.com
Message:

v 1.0.7

Location:
2kb-amazon-affiliates-store/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • 2kb-amazon-affiliates-store/trunk/KbAmazonImporter.php

    r932407 r1004924  
    543543        }
    544544       
    545        
    546545        $metaToInsert = $this->updateProductPostMeta($meta, $postId);
    547546       
  • 2kb-amazon-affiliates-store/trunk/KbAmazonStore.php

    r993771 r1004924  
    4343            'code' => 'kb_amz_product_content',
    4444            'params' => array(
    45                 'show-all-reviews' => 'Yes/No',
    46                 'show-title' => 'Yes/No',
    47                 'strip-tags' => 'No/Yes',
    48                 'replace' => 'No/Yes - replace the short code result directly in the post'
     45                'show_all_reviews' => '<b>Yes</b>/No',
     46                'show_title' => '<b>Yes</b>/No',
     47                'strip_tags' => '<b>No</b>/Yes',
     48                'replace' => '<b>No</b>/Yes - replace the short code result directly in the post'
    4949            ),
    5050            'active' => true,
     
    7474            'code' => 'kb_amz_list_products',
    7575            'params' => array(
     76                'featured' => '<b>No</b>/Yes',
     77                'featured_content_length' => '<b>300</b> / any number',
    7678                'items_per_row' => '2,3,4,6',
    7779                'posts_per_page' => 'Number',
     
    8082                'post_status' => 'Always - any',
    8183                'title' => 'String',
    82                 'attributeKey' => '(See Product Attributes)',
    83                 'attributeValue' => '(Explore Attributes Value)',
    84                 'attributeCompare' => "'=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN'"
     84                'attribute_key' => '(See Product Attributes)',
     85                'attribute_value' => '(Explore Attributes Value)',
     86                'attribute_compare' => "'=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN'"
    8587            ),
    8688            'active' => true,
     
    591593        }
    592594    }
     595   
     596    public function getProductContent($id)
     597    {
     598        $meta = $this->getProductMeta($id);
     599        return isset($meta['KbAmzEditorialReviews.EditorialReview.0.Content'])
     600               ? $meta['KbAmzEditorialReviews.EditorialReview.0.Content'] : '';
     601    }
    593602
    594603    public function getCartButtonHtml($id)
  • 2kb-amazon-affiliates-store/trunk/plugin.php

    r993771 r1004924  
    44 * Plugin URI: http://www.2kblater.com/?p=8318
    55 * Description: Amazon Affiliate Store Plugin With Cart, Checkout, Custom Themes. Easy to manage and setup. Sell wide range of physical and digital products imported from Amazon Affiliate API using 90 days cookie reference. This plugin is released with GPL2 license.
    6  * Version: 1.0.6
     6 * Version: 1.0.7
    77 * Author: 2kblater.com
    88 * Author URI: http://www.2kblater.com
     
    1616}
    1717
    18 define('KbAmazonVersion', '1.0.6');
    19 define('KbAmazonVersionNumber', 106);
     18define('KbAmazonVersion', '1.0.7');
     19define('KbAmazonVersionNumber', 107);
    2020define('KbAmazonStoreFolderName',  pathinfo(dirname(__FILE__), PATHINFO_FILENAME));
    2121define('KbAmazonStorePluginPath',  dirname(__FILE__) . '/');
  • 2kb-amazon-affiliates-store/trunk/readme.txt

    r993771 r1004924  
    33Requires at least: 4.0
    44Tested up to: 4.0
    5 Stable tag: 1.0.6
     5Stable tag: 1.0.7
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3636
    3737== Changelog ==
    38 
     38= 1.0.7 =
     39Short Codes bug fixed - all shortcodes use '_' instead of '-'.
     40Added option for featured content in [kb_amz_list_products featured="Yes" featured_content_length="150"]. Content is loaded from the_excerpt or the product description.
     41Bug fixed when using [kb_amz_list_products] in product shortcode content. (product is excluded from the query).
    3942= 1.0.6 =
    4043Category accept functions in [kb_amz_list_products] and items_per_row added.
  • 2kb-amazon-affiliates-store/trunk/store_functions.php

    r993771 r1004924  
    352352    }
    353353}
     354
     355function getKbAmzExcerptFromContent($postcontent, $length)
     356{
     357    $this_excerpt = strip_shortcodes( $postcontent );
     358    $this_excerpt = strip_tags($this_excerpt);
     359    $this_excerpt = substr($this_excerpt, 0, $length);
     360   
     361    $parts = preg_split('/([\s\n\r]+)/', $this_excerpt, null, PREG_SPLIT_DELIM_CAPTURE);
     362    $parts_count = count($parts);
     363
     364    $length = 0;
     365    $last_part = 0;
     366    for (; $last_part < $parts_count; ++$last_part) {
     367      $length += strlen($parts[$last_part]);
     368      if ($length > $length) { break; }
     369    }
     370
     371    return implode(array_slice($parts, 0, $last_part));
     372}
  • 2kb-amazon-affiliates-store/trunk/store_shortcodes.php

    r993771 r1004924  
    102102// [kb_amz_product_content]
    103103function kb_amz_product_content_func($atts) {
     104   
    104105    $atts = shortcode_atts( array(
    105             'show-all-reviews' => 'Yes',
    106             'show-title' => 'Yes',
    107             'strip-tags' => 'No',
     106            'show_all_reviews' => 'Yes',
     107            'show_title' => 'Yes',
     108            'strip_tags' => 'No',
    108109            'id' => null
    109110    ), $atts);
     
    126127</div>
    127128HTML;
     129       
    128130        $postId = $atts['id'] ? $atts['id'] : get_the_ID();
    129131        $meta = getKbAmz()->getProductMetaArray($postId);
     
    137139            $contents = array();
    138140            foreach ($reviews as $review) {
    139                 if (kbAmzShortCodeBool($atts['show-title'])) {
     141                if (kbAmzShortCodeBool($atts['show_title'])) {
    140142                    $headers[]  = $review['Source'];
    141143                }
    142144               
    143                 $contents[] = kbAmzShortCodeBool($atts['strip-tags'])
     145                $contents[] = kbAmzShortCodeBool($atts['strip_tags'])
    144146                            ? strip_tags($review['Content'])
    145147                            : $review['Content'];
    146                 if (!kbAmzShortCodeBool($atts['show-all-reviews'])) {
     148                if (!kbAmzShortCodeBool($atts['show_all_reviews'])) {
    147149                    break;
    148150                }
     
    284286function kb_amz_list_products($atts) {
    285287    $atts = shortcode_atts( array(
     288        'featured'          => null,
     289        'featured_content_length' => 300,
    286290        'posts_per_page'    => get_option('posts_per_page', 10),
    287291        'category'          => null,
    288292        'post_status'       => 'any',
    289         'attributeKey'      => null,
    290         'attributeValue'    => null,
    291         'attributeCompare'  => '=',
     293        'attribute_key'      => null,
     294        'attribute_value'    => null,
     295        'attribute_compare'  => '=',
    292296        'title'             => null,
    293297        'pagination'        => 'Yes',
     
    319323    $atts['cat']            = $category;
    320324    $atts['post_type']      = 'post';
    321     $atts['meta_key']       = 'KbAmzASIN';
     325    //$atts['meta_key']       = 'KbAmzASIN';
    322326    $atts['post_status']    = 'any';
    323327    $atts['paged']          = getKbAmzPaged();
    324    
    325     if (isset($atts['attributeKey']) && isset($atts['attributeValue'])) {
    326         $atts['meta_query'] = array(
    327             'key' => $atts['attributeKey'],
    328             'value' => $atts['attributeValue'],
    329             'compare' => $atts['attributeCompare']
    330         );
    331     }
    332     kbAmzIsMainQuery(true);   
     328    $atts['meta_query']     = array();
     329    $atts['meta_query'][]   = array(
     330        'key' => 'KbAmzASIN'
     331    );
     332       
     333    if (null !== $atts['attribute_key'] && null !== $atts['attribute_value']) {
     334        $atts['meta_query'][] = array(
     335            'key' => $atts['attribute_key'],
     336            'value' => $atts['attribute_value'],
     337            'compare' => str_replace(array('&gt;', '&lt;'), array('>', '<'), $atts['attribute_compare'])
     338        );
     339    }
     340   
     341    if (get_the_ID() && getKbAmz()->isPostProduct(get_the_ID())) {
     342        $atts['post__not_in'] = array(get_the_ID());
     343    }
     344   
     345    $currentPost = null;
     346    if (get_the_ID()) {
     347        global $post;
     348        $currentPost = $post;
     349    }
     350   
     351    kbAmzIsMainQuery(true);
    333352    $posts = query_posts($atts);
    334353    $atts['maxNumPages'] = $GLOBALS['wp_query']->max_num_pages;
    335354    $atts['posts']       = $posts;
     355    $atts['featured'] = kbAmzShortCodeBool($atts['featured']);
    336356    $view = getKbAmzTemplate()->getProductsView($atts)->getContent();
    337357    wp_reset_query();
    338358    kbAmzIsMainQuery(false);
    339    
     359    if (get_the_ID()) {
     360        setup_postdata($currentPost);
     361    }
    340362    return $view;
    341363}
  • 2kb-amazon-affiliates-store/trunk/template/admin/css/default.css

    r920982 r1004924  
    7474    margin-top: 10px;
    7575}
     76.homepage .label{
     77    display: inline-block;
     78    margin-bottom: 5px;
     79}
  • 2kb-amazon-affiliates-store/trunk/template/admin/importBySearch.phtml

    r920982 r1004924  
    11<form role="form" method="post">
     2    <div class="alert alert-success">User Category from the select or write down your own. <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html" target="_blank">Check this link for amazon categories</a></div>
    23    <div class="row">
    34        <div class="col-xs-4">
  • 2kb-amazon-affiliates-store/trunk/template/admin/index.phtml

    r993771 r1004924  
    1 <div class="row">
     1<div class="row homepage">
    22
    33    <div class="col-sm-3">
  • 2kb-amazon-affiliates-store/trunk/template/admin/productsShortCodes.phtml

    r993771 r1004924  
    2121                                $params[] = $nameParamName . '="'.$avaialbe.'"';
    2222                            }
    23                             echo implode(', ', $params);
     23                            echo implode(' ', $params);
    2424                        ?>
    2525                    </td>
     
    4949    <div class="form-group">
    5050        <label class="control-label" for="updateForAllPosts">
    51             <?php echo __('Update For All Existing Products.'); ?>
     51            <?php echo __('Update For All Existing Products. Note that if some product is updated manualy, all the changes will be lost with option Yes.'); ?>
    5252        </label>
    5353        <select value="<?php echo getKbPostVar('updateForAllPosts', 0);?>" name="updateForAllPosts" class="form-control">
  • 2kb-amazon-affiliates-store/trunk/template/admin/version.phtml

    r993771 r1004924  
    11<div class="row" id="kb-amz-version">
    22    <div class="col-sm-12">
     3        <h4>1.0.7</h4>
     4        <ul style="list-style-type: disc;">
     5            <li>Short Codes bug fixed - all shortcodes use '_' instead of '-'.</li>
     6           <li>Added option for featured content in [kb_amz_list_products featured="Yes" featured_content_length="150"]. Content is loaded from the_excerpt or the product description.</li>
     7           <li>Bug fixed when using [kb_amz_list_products] in product shortcode content. (product is excluded from the query).</li>
     8        </ul>   
    39        <h4>1.0.6</h4>
    410        <ul style="list-style-type: disc;">
  • 2kb-amazon-affiliates-store/trunk/template/default/css/style.css

    r920982 r1004924  
    346346    line-height: 0;
    347347}
     348
     349.kb-amz-row-item-part.featured .kb-amz-item-list-img img{
     350    margin: 0!important;
     351    /*position: initial!important;*/
     352}
     353
     354.kb-amz-row-item-part.featured .kb-amz-item-list-img a{
     355    float: left;
     356    width: 50%;
     357    position: relative;
     358    height: 100%;
     359}
     360.kb-amz-featured-content{
     361    float: left;
     362    width: 49%;
     363    padding-left: 1%;
     364}
    348365/*TB*/
    349366.row {
  • 2kb-amazon-affiliates-store/trunk/template/view/partial/product.phtml

    r993771 r1004924  
    1818    $sm = 4;
    1919    $xs = 4;
    20 }
    21 
     20} else if ($c == 2) {
     21    $lg = 6;
     22    $md = 6;
     23    $sm = 6;
     24    $xs = 6;
     25};
    2226?>
    2327
    24 <li class="kb-amz-per-row-<?php echo $c; ?> col-lg-<?php echo $lg; ?> col-md-<?php echo $md; ?> col-sm-<?php echo $sm; ?> col-xs-<?php echo $xs; ?> kb-amz-row-item-part <?php echo getKbAmz()->getOption('productListImageSize'); ?>">
     28<li class="kb-amz-per-row-<?php echo $c; ?> col-lg-<?php echo $lg; ?> col-md-<?php echo $md; ?> col-sm-<?php echo $sm; ?> col-xs-<?php echo $xs; ?> kb-amz-row-item-part <?php echo getKbAmz()->getOption('productListImageSize'); ?> <?php echo $this->featured ? 'featured' : 'not-featured'; ?>">
    2529    <article id="post-<?php echo $p->ID; ?>" <?php post_class('kb-amz-product', $p->ID); ?>>
    2630        <header>
     
    3539                    ?>
    3640                </a>
     41                <?php if ($this->featured) : ?>
     42                <div class="kb-amz-featured-content">
     43                    <?php
     44                    if (!empty($p->post_excerpt)) {
     45                        echo $p->post_excerpt;
     46                    } else {
     47                        $content = getKbAmz()->getProductContent($p->ID);
     48                        echo getKbAmzExcerptFromContent($content, $this->featured_content_length);
     49                    }
     50                    ?>
     51                </div>
     52                <?php endif; ?>
    3753                <?php echo getKbAmz()->getProductSticker($p->ID); ?>
    3854            </div>
  • 2kb-amazon-affiliates-store/trunk/template/view/products.phtml

    r993771 r1004924  
    2525                $i = 0;
    2626            }
     27            setup_postdata($p);
    2728            include dirname(__FILE__) . '/partial/product.phtml';
    2829            $i++;
Note: See TracChangeset for help on using the changeset viewer.