Plugin Directory

Changeset 1519229


Ignore:
Timestamp:
10/21/2016 12:21:06 PM (9 years ago)
Author:
reviewbuilder
Message:

New version of Review Builder 1.1.7

Location:
review-builder/trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • review-builder/trunk/app.php

    r1513332 r1519229  
    44 * Plugin URI: https://sygnoos.com
    55 * Description: Review Builder will allow you to add reviews section to your site. Build a reviews section so customers can leave reviews for your products.
    6  * Version: 1.1.6
     6 * Version: 1.1.7
    77 * Author: Sygnoos
    88 * Author URI: https://www.sygnoos.com
  • review-builder/trunk/assets/page/scripts/save.js

    r1513332 r1519229  
    1919    }
    2020
     21    if (jQuery('#wooReviewShowTypeProduct').attr('checked')) {
     22        var productsToLoad = jQuery('input[name=productsToLoad]').val();
     23        var reviewId = jQuery('input[name=sgrb-id]').val();
     24        if (!reviewId) {
     25            reviewId = 0;
     26        }
     27        SGRB.ajaxWooProductLoad(0,reviewId,productsToLoad);
     28    }
    2129
    2230    jQuery('.sgrb-tagcloud-link').click(function(){
    2331        jQuery('.sgrb-tags-cloud').toggle();
    2432    });
     33
     34    jQuery('.sgrb-select-all-products').click(function(){
     35        jQuery('.sgrb-woo-product').prop('checked', this.checked);
     36    });
     37
     38    jQuery('.sgrb-select-all-categories').click(function(){
     39        jQuery('.sgrb-selected-categories').prop('checked', this.checked);
     40    });
     41
     42    jQuery('#wooReviewShowType').click(function(){
     43        jQuery('.sgrb-woo-products-wrapper').hide();
     44        jQuery('.sgrb-woo-products-select-all').hide();
     45        jQuery('.sgrb-woo-category-wrapper').show();
     46        jQuery('.sgrb-woo-categories-select-all').show();
     47    });
     48
     49    jQuery('#wooReviewShowTypeProduct').click(function(){
     50        jQuery('.sgrb-woo-category-wrapper').hide();
     51        jQuery('.sgrb-woo-categories-select-all').hide();
     52        jQuery('.sgrb-woo-products-wrapper').show();
     53        jQuery('.sgrb-woo-products-select-all').show();
     54       
     55        if (jQuery('.sgrb-no-first-click').length < 1) {
     56            var productsToLoad = jQuery('input[name=productsToLoad]').val();
     57            var reviewId = jQuery('input[name=sgrb-id]').val();
     58            if (!reviewId) {
     59                reviewId = 0;
     60            }
     61            SGRB.ajaxWooProductLoad(0,reviewId,productsToLoad);
     62        }
     63    });
     64
    2565    var reviewId = jQuery('.sgrb-reviewId').val();
    2666    var commentFormWrapper = jQuery('#sgrb-review-'+reviewId);
     
    232272                                    jQuery('.sgrb-main-template-wrapper').hide();
    233273                                    jQuery('.sgrb-template-options-box').hide();
     274                                    jQuery('.sgrb-woo-template-wrapper').hide();
    234275                                    jQuery('.sgrb-post-template-wrapper').show();
    235276                                    jQuery('.sgrb-template-post-box').attr('style', 'min-height:150px;');
     277                                }
     278                                else if (tempName == 'woo_review') {
     279                                    jQuery('.sgrb-main-template-wrapper').hide();
     280                                    jQuery('.sgrb-template-options-box').hide();
     281                                    jQuery('.sgrb-post-template-wrapper').hide();
     282                                    jQuery('.sgrb-woo-template-wrapper').show();
     283                                    jQuery('.sgrb-template-post-box').attr('style', 'min-height:150px;');
     284                                    jQuery('input[name=wooReviewShowType]').each(function(){
     285                                        if (jQuery(this).attr('checked')) {
     286                                            var wooReviewShowType = jQuery(this).val();
     287                                            if (wooReviewShowType == 'showByProduct') {
     288                                                jQuery('.sgrb-woo-category-wrapper').hide();
     289                                                jQuery('.sgrb-woo-categories-select-all').hide();
     290                                                jQuery('.sgrb-woo-products-wrapper').show();
     291                                                jQuery('.sgrb-woo-products-select-all').show();
     292
     293                                            }
     294                                            else if (wooReviewShowType == 'showByCategory') {
     295                                                jQuery('.sgrb-woo-products-wrapper').hide();
     296                                                jQuery('.sgrb-woo-products-select-all').hide();
     297                                                jQuery('.sgrb-woo-category-wrapper').show();
     298                                                jQuery('.sgrb-woo-categories-select-all').show();
     299                                            }
     300                                        }
     301                                    });
    236302                                }
    237303                                else {
     
    239305                                    jQuery('.sgrb-template-options-box').show();
    240306                                    jQuery('.sgrb-post-template-wrapper').hide();
     307                                    jQuery('.sgrb-woo-template-wrapper').hide();
    241308                                    that.ajaxSelectTemplate(tempName);
    242309                                }
     
    417484        return;
    418485    }
     486    var products = {};
     487    if (jQuery('input[name=sgrb-template]').val() == 'woo_review') {
     488        if (jQuery('#wooReviewShowTypeProduct').attr('checked')) {
     489            if (reviewId) {
     490                var currentProducts = jQuery('.sgrb-all-products-categories').val();
     491                products = JSON.parse(currentProducts);
     492            }
     493            jQuery('.sgrb-woo-product').each(function(){
     494                if (jQuery(this).attr('checked') && !jQuery(this).attr('disabled')) {
     495                    var eachCategoryId = jQuery(this).val();
     496                    products[eachCategoryId] = 1;
     497                }
     498                if (!jQuery(this).attr('checked') && !jQuery(this).attr('disabled')) {
     499                    var eachCategoryId = jQuery(this).val();
     500                    products[eachCategoryId] = 0;
     501                }
     502            });
     503            jQuery('.sgrb-all-products-categories').val(JSON.stringify(products));
     504        }
     505        else if (jQuery('#wooReviewShowType').attr('checked')) {
     506            var id = '';
     507            jQuery('.sgrb-woo-category').each(function(){
     508                if (jQuery(this).attr('checked')) {
     509                    var eachCategoryId = jQuery(this).val();
     510                    id += eachCategoryId+',';
     511                    jQuery('.sgrb-all-products-categories').val(id);
     512                }
     513            });
     514        }
     515    }
     516
     517
    419518    jQuery('.fontSelectbox').val(font);
    420519    var saveAction = 'Review_ajaxSave';
     
    508607    }
    509608    ajaxHandler.run();
     609};
     610
     611SGRB.ajaxWooProductLoad = function(start,reviewId,perPage){
     612    var productsToLoad = jQuery('input[name=productsToLoad]').val();
     613    var allProductsCount = jQuery('input[name=allProductsCount]').val();
     614    productsToLoad = parseInt(productsToLoad);
     615    if (!productsToLoad || productsToLoad == 0) {
     616        alert('Products count to load is not valid (min-max: 1-999)');
     617        jQuery('input[name=productsToLoad]').val('');
     618        jQuery('input[name=productsToLoad]').focus();
     619        return;
     620    }
     621    perPage = 500;
     622    if (jQuery('.sgrb-woo-products-wrapper').hasClass('sgrb-no-first-click')) {
     623        perPage = productsToLoad;
     624    }
     625    jQuery('.sgrb-woo-products-wrapper').show();
     626    var loading = 'Loading...';
     627    jQuery('.sgrb-categories-selector').val(loading);
     628    var productsHtml = '';
     629    var loadItemsAction = 'Review_ajaxWooProductLoad';
     630    var ajaxHandler = new sgrbRequestHandler(loadItemsAction, {start:start,reviewId:reviewId,perPage:perPage});
     631    ajaxHandler.dataType = 'html';
     632    ajaxHandler.callback = function(response){
     633        jQuery('.sgrb-load-more-woo').remove();
     634        var obj = jQuery.parseJSON(response);
     635        if (jQuery.isEmptyObject(obj)) {
     636            productsHtml += '<div class="sgrb-each-product-wrapper"><span class="sgrb-woo-product-category-name">No products found</span></div>';
     637            jQuery('.sgrb-woo-products-wrapper').prepend(productsHtml);
     638            return;
     639        }
     640        else {
     641            var allowCheck = '';
     642            var disableClass = '';
     643
     644            for(var i in obj) {
     645                if (obj[i].matchProdId) {
     646                    disableClass = ' sgrb-disable-woo-products';
     647                    allowCheck = '';
     648                }
     649                else {
     650                    disableClass = '';
     651                    allowCheck = 'sgrb-woo-product ';
     652                }
     653                productsHtml += '<div class="sgrb-each-product-wrapper"><label for="sgrb-woo-product-'+obj[i].id+'">';
     654                productsHtml += '<input class="'+allowCheck+obj[i].checkedClass+'" id="sgrb-woo-product-'+obj[i].id+'" type="checkbox" value="'+obj[i].id+'"'+obj[i].checked+obj[i].matchProdId+'>';
     655                productsHtml += '<span class="sgrb-woo-product-category-name'+disableClass+'">'+obj[i].name+obj[i].matchReview+'</span>';
     656                productsHtml += '</label></div>';
     657            }
     658            start = parseInt(start)+parseInt(productsToLoad);
     659            if (allProductsCount > start) {
     660                productsHtml += '<div class="sgrb-load-more-woo"><input onclick="SGRB.ajaxWooProductLoad('+start+','+reviewId+','+productsToLoad+')" class="button-small button sgrb-categories-selector" value="Load more products" type="button"></div>';
     661            }
     662            else {
     663                jQuery('input[name=productsToLoad]').attr('disabled', 'disabled');
     664                productsHtml += '<div class="sgrb-load-more-woo"><input class="button-small button sgrb-categories-selector" value="No more products" type="button" disabled></div>';
     665            }
     666            jQuery('.sgrb-woo-products-wrapper').addClass('sgrb-no-first-click');
     667            jQuery('.sgrb-woo-products-wrapper').append(productsHtml);
     668        }
     669
     670    }
     671    ajaxHandler.run();
     672
    510673};
    511674
  • review-builder/trunk/assets/page/styles/save.css

    r1508588 r1519229  
    2525.sg-compatible {
    2626    overflow: hidden !important;
     27}
     28
     29.sgrb-woo-category-wrapper,
     30.sgrb-woo-products-wrapper,
     31.sgrb-woo-products-select-all,
     32.sgrb-woo-categories-select-all {
     33    background-color: rgb(250,250,250) !important;
     34    margin: 0px 20px 5px 20px !important;
     35    overflow: auto !important;
     36    max-height: 150px !important;
     37    min-width: 150px !important;
     38    width: 100% !important;
     39}
     40
     41.sgrb-woo-products-select-all,
     42.sgrb-woo-categories-select-all {
     43    margin: 5px 20px 0px 20px !important;
     44}
     45
     46.sgrb-woo-products-select-all,
     47.sgrb-woo-categories-select-all {
     48    border: 1px solid #e3e3e3 !important;
     49    border-bottom: none !important; 
     50}
     51
     52.sgrb-woo-products-wrapper,
     53.sgrb-woo-category-wrapper {
     54    border: 1px solid #e3e3e3 !important;
     55    border-top: none !important;
     56}
     57
     58.sgrb-disable-woo-products {
     59    color: #a3a3a3 !important;
     60}
     61
     62.sgrb-disable-woo-comments-wrapper {
     63    margin-top: 15px !important;
     64}
     65
     66.sgrb-products-selector ,
     67.sgrb-categories-selector {
     68    height: 20px !important;
     69    /*width: 100px !important;*/
     70    line-height: 18px !important;
     71    width: 100% ! important;
     72    background-color: #DDE2E0 !important;
     73    text-shadow: 1px 1px white !important;
     74    color: rgb(77, 77, 77) !important;
     75    font-weight: bold !important;
     76}
     77
     78.sgrb-load-more-woo {
     79    text-align: center !important;
     80    margin: 5px !important;
     81}
     82
     83.sgrb-each-product-wrapper,
     84.sgrb-select-checkbox,
     85.sgrb-each-category-wrapper {
     86    padding: 0 5px;
     87}
     88
     89.sgrb-select-checkbox {
     90    border-bottom: 1px solid #e3e3e3 !important;
     91    height: 22px !important;
     92}
     93
     94.sgrb-select-checkbox span {
     95    float:right;
     96    font-size:12px;
     97    font-weight:bold;
     98    color:#838383;
     99}
     100
     101.sgrb-select-checkbox span input {
     102    width:32px;
     103    height:20px;
     104    border-radius:4px;
     105    font-weight:normal;
     106    font-size:12px;
     107}
     108
     109.sgrb-is-used {
     110    color:#ff5f5f !important;
     111    font-weight: normal !important;
     112}
     113
     114.sgrb-woo-product-category-name {
     115    font-weight: bold !important;
    27116}
    28117
  • review-builder/trunk/com/config/autoload.php

    r1487981 r1519229  
    9999    array(
    100100        'controller' => 'Review',
    101         'action' => 'ajaxSave',
     101        'action'    => 'ajaxSave',
    102102    ),
    103103    array(
    104104        'controller' => 'Review',
    105         'action' => 'ajaxDelete',
     105        'action'     => 'ajaxDelete',
     106    ),
     107    array(
     108        'controller' => 'Review',
     109        'action'     => 'ajaxWooProductLoad',
    106110    ),
    107111    array(
    108112        'controller' => 'Comment',
    109         'action' => 'ajaxSave',
     113        'action'    => 'ajaxSave',
    110114    ),
    111115    array(
    112116        'controller' => 'Comment',
    113         'action' => 'ajaxDelete',
     117        'action'    => 'ajaxDelete',
    114118    ),
    115119    array(
    116120        'controller' => 'Comment',
    117         'action' => 'ajaxApproveComment',
     121        'action'    => 'ajaxApproveComment',
    118122    ),
    119123    array(
    120124        'controller' => 'Comment',
    121         'action' => 'ajaxSelectReview',
     125        'action'    => 'ajaxSelectReview',
    122126    ),
    123127    array(
    124128        'controller' => 'Comment',
    125         'action' => 'ajaxSelectPosts',
     129        'action'    => 'ajaxSelectPosts',
    126130    ),
    127131    array(
    128132        'controller' => 'Review',
    129         'action' => 'ajaxDeleteField',
     133        'action'    => 'ajaxDeleteField',
    130134    ),
    131135    array(
    132136        'controller' => 'Review',
    133         'action' => 'ajaxPostComment',
     137        'action'    => 'ajaxPostComment',
    134138    ),
    135139    array(
    136140        'controller' => 'Review',
    137         'action' => 'ajaxSelectTemplate',
     141        'action'    => 'ajaxSelectTemplate',
    138142    ),
    139143    array(
    140144        'controller' => 'Review',
    141         'action' => 'ajaxPagination',
     145        'action'    => 'ajaxPagination',
    142146    ),
    143147    array(
    144148        'controller' => 'Review',
    145         'action' => 'ajaxUserRate',
     149        'action'    => 'ajaxUserRate',
    146150    ),
    147151    array(
    148152        'controller' => 'TemplateDesign',
    149         'action' => 'ajaxSave',
     153        'action'    => 'ajaxSave',
    150154    ),
    151155    array(
    152156        'controller' => 'TemplateDesign',
    153         'action' => 'ajaxDeleteTemplate',
     157        'action'    => 'ajaxDeleteTemplate',
    154158    )
    155159);
     
    158162    array(
    159163        'controller' => 'Review',
    160         'action' => 'delete',
     164        'action'    => 'delete',
    161165    )
    162166);
  • review-builder/trunk/com/config/config.php

    r1513332 r1519229  
    33define('SGRB_COMMENTS_PER_PAGE', 10);
    44define('SGRB_PRO_VERSION', 0);
    5 define('SGRB_VERSION', '1.1.6');
     5define('SGRB_VERSION', '1.1.7');
    66define('SG_REVIEW_BANNER', 'sg-review-banner');
    77define('SGRB_RATE_TYPE_STAR', 1);
  • review-builder/trunk/com/controllers/Review.php

    r1513332 r1519229  
    1313$sgrb->includeModel('Comment_Rating');
    1414$sgrb->includeModel('Rate_Log');
     15$sgrb->includeModel('Page_Review');
    1516
    1617class SGRB_ReviewController extends SGRB_Controller
     
    6970        global $sgrb;
    7071        $sgrb->includeCore('Template');
    71        
     72
    7273        $tempOptions = array();
    7374        $options = array();
    7475        $tagsArray = array();
     76        $currentReviewProducts = array();
    7577        $reviewId = 0;
    7678        $isUpdate = false;
     
    8890
    8991        if (count($_POST)) {
     92
    9093            $reviewId = (int)$_POST['sgrb-id'];
    9194
     
    9497           
    9598            if ($reviewId) {
     99
    96100                $isUpdate = true;
    97101                $reviewId = (int)$_POST['sgrb-id'];
    98102                $review = SGRB_ReviewModel::finder()->findByPk($reviewId);
     103                $options = $review->getOptions();
     104                $options = json_decode($options, true);
     105
     106                $wooOptions = $options['woo-products'];
     107                $currentReviewProducts = json_decode($wooOptions);
    99108                if (!$review) {
    100109                    return;
    101110                }
    102             }
    103 
     111
     112            }
    104113            ////////////////////////////
    105114
     
    116125
    117126            /////////////////////////////
    118 
    119127            $tempateShadowColor = '';
    120128            $shadowLeftRight = '';
     
    147155            $shadowBlur = @$_POST['shadow-blur'];
    148156            $postCategory = @$_POST['post-category'];
     157            // wooCommerce
     158            $wooReviewShowType = @$_POST['wooReviewShowType'];
     159
     160            if ($wooReviewShowType == 'showByCategory') {
     161                $wooProductsCategories = @$_POST['allProductsCategories'];
     162                $wooProductsCategories = rtrim($wooProductsCategories, ',');
     163                $wooCategory = explode(',', $wooProductsCategories);
     164                $wooCategoryString = json_encode($wooCategory);
     165                $wooProducts = array();
     166            }
     167            else if ($wooReviewShowType == 'showByProduct') {
     168                $wooCategory = array();
     169                $wooProductsCategories = @$_POST['allProductsCategories'];
     170                $wooProductsCategories = str_replace('\"', '"', $wooProductsCategories);
     171                $wooProductsCategories = json_decode($wooProductsCategories, true);
     172
     173                if (!empty($currentReviewProducts)) {
     174                    foreach ($wooProductsCategories as $prod => $val) {
     175                        if ($val == 0) {
     176                            unset($wooProductsCategories[$prod]);
     177                        }
     178                        else {
     179                            $wooProductsCategories[$prod] = 1;
     180                        }
     181                    }
     182                }
     183               
     184                $wooProducts = $wooProductsCategories;
     185                $wooProductsString = json_encode($wooProductsCategories);
     186            }
     187            $disableWooComments = @$_POST['disableWooComments'];
     188            // wooCommerce
    149189            $disableWPcomments = @$_POST['disableWPcomments'];
    150190            $commentsCount = (int)@$_POST['comments-count-to-show'];
     
    172212            $noCaptchaText = @$_POST['no-captcha-text'];
    173213            //////////////////////
    174 
    175214            $options['notify'] = '';
    176215            $options['required-title-checkbox'] = '';
     
    180219            $options['sgrb-google-search-on'] = '';
    181220            $options['disableWPcomments'] = '';
     221            // wooCommerce
     222            $options['disableWooComments'] = '';
     223            // wooCommerce
    182224            $options['comments-count-to-show'] = '';
    183225            $options['comments-count-to-load'] = '';
    184226            $options['captcha-on'] = '';
    185227            if (SGRB_PRO_VERSION) {
     228                // wooCommerce
     229                $options['wooReviewShowType'] = $wooReviewShowType;
     230                // wooCommerce
    186231                $options['captcha-text'] = $captchaText;
    187232                $options['logged-in-text'] = $loggedInText;
     
    216261                $options['disableWPcomments'] = 1;
    217262            }
     263            // wooCommerce
     264            if ($disableWooComments) {
     265                $options['disableWooComments'] = 1;
     266            }
     267            if ($tempOptions['name'] == 'woo_review') {
     268                if ($wooReviewShowType == 'showByCategory') {
     269                    $options['woo-category'] = $wooCategoryString;
     270                }
     271                else if ($wooReviewShowType == 'showByProduct') {
     272                    $options['woo-products'] = $wooProductsString;
     273                }
     274            }
     275            // wooCommerce
    218276            if ($postCategory && $tempOptions['name'] == 'post_review') {
    219277                $options['post-category'] = $postCategory;
     
    251309            $options['no-comment-text'] = $noCommentText;
    252310            ///////////////
    253 
    254311            $options['total-rate'] = $totalRate;
    255312            $options['show-comments'] = $showComments;
     
    267324
    268325            $options = json_encode($options);
    269 
    270326            $review->setTitle(sanitize_text_field($title));
    271327            $review->setTemplate_id(sanitize_text_field($result));
     
    288344            if (!$lastRevId && $reviewId) {
    289345                $lastRevId = $review->getId();
     346            }
     347
     348            if ($tempOptions['name'] == 'woo_review') {
     349                SGRB_Page_ReviewModel::finder()->deleteAll('review_id = %d', $lastRevId);
     350                if (!empty($wooProducts)) {
     351                    foreach ($wooProducts as $wooProd => $val) {
     352                        if ($val == 1) {
     353                            $pageReview = new SGRB_Page_ReviewModel();
     354                            $pageReview->setProduct_id(sanitize_text_field($wooProd));
     355                            $pageReview->setReview_id(sanitize_text_field($lastRevId));
     356                            $pageReview->save();
     357                        }
     358                    }
     359                }
     360                else if (!empty($wooCategory)) {
     361                    for ($i = 0;$i < count($wooCategory);$i++) {
     362                        $pageReview = new SGRB_Page_ReviewModel();
     363                        $pageReview->setCategory_id(sanitize_text_field($wooCategory[$i]));
     364                        $pageReview->setReview_id(sanitize_text_field($lastRevId));
     365                        $pageReview->save();
     366                    }
     367                }
    290368            }
    291369
     
    335413        $ratings = array();
    336414        $allTemplates = array();
     415        $termsArray = array();
     416        $productsArray = array();
     417        $categoriesArray = array();
     418        $allPageReviews = array();
     419        $matchesProducts = array();
     420        $matchesCategories = array();
     421
     422        $allTerms = get_terms(array('get' => 'all'));
     423        $allProductsCount = get_posts(array(
     424            'post_type'     => 'product',
     425            'numberposts'   => -1
     426        ));
     427        if (!empty($allProductsCount)) {
     428            $allProductsCount = count($allProductsCount);
     429        }
     430        foreach ($allTerms as $term) {
     431            if (get_term_meta($term->term_id)) {
     432                $termsArray['id'][] = $term->term_id;
     433                $termsArray['name'][] = $term->name;
     434            }
     435        }
     436
     437        $allProducts = get_posts(array('post_type' => 'product','numberposts' => 5));
     438        foreach ($allProducts as $product) {
     439            $productsArray['id'][] = $product->ID;
     440            $productsArray['name'][] = $product->post_title;
     441        }
     442
    337443        $tempView = new SGRB_TemplateDesignView();
    338444        $allTemplates = SGRB_TemplateDesignModel::finder()->findAllBySql("SELECT * from ".$tempView->getTablename()."  ORDER BY ".$tempView->getTablename().".sgrb_pro_version DESC");
    339445
    340446        isset($_GET['id']) ? $sgrbId = (int)$_GET['id'] : 0;
     447        $allPageReviews = SGRB_Page_ReviewModel::finder()->findAll();
     448        for ($i=0;$i<count($allPageReviews);$i++) {
     449            for ($j=0;$j<count($productsArray['id']);$j++) {
     450                $catId = $allPageReviews[$i]->getCategory_id();
     451                $prodId = $allPageReviews[$i]->getProduct_id();
     452                $revId = $allPageReviews[$i]->getReview_id();
     453                if ($prodId) {
     454                    if ($prodId == $productsArray['id'][$j] && $revId != $sgrbId) {
     455                        $matchesProducts['id'][] = $prodId;
     456                        if ($revId) {
     457                            $matchReview = SGRB_ReviewModel::finder()->findByPk($revId);
     458                            if ($matchReview) {
     459                                $matchReviewTitle = $matchReview->getTitle();
     460                                $matchesProducts['review'][] = $matchReviewTitle;
     461                            }
     462                        }
     463                    }
     464                }
     465                if ($catId) {
     466                    if ($catId == @$termsArray['id'][$j] && $revId != $sgrbId) {
     467                        $matchesCategories['id'][] = $catId;
     468                        if ($revId) {
     469                            $matchReview = SGRB_ReviewModel::finder()->findByPk($revId);
     470                            if ($matchReview) {
     471                                $matchReviewTitle = $matchReview->getTitle();
     472                                $matchesCategories['review'][] = $matchReviewTitle;
     473                            }
     474                        }
     475                    }
     476                }
     477            }
     478        }
    341479        $sgrbRev = SGRB_ReviewModel::finder()->findByPk($sgrbId);
    342480        $allCommentsUrl = $sgrb->adminUrl('Comment/index','id='.$sgrbId);
     
    361499            }
    362500            $tempName = $template->getName();
    363             // if template not found 'tempo' as default
     501            // if template not found 'full_width' as default
    364502            if (!$tempName) {
    365503                $tempName = 'full_width';
     
    372510
    373511            $options = $sgrbRev->getOptions();
    374             $options = json_decode($options, true);         
     512            $options = json_decode($options, true);
    375513
    376514            $sgrbDataArray['title'] = $title;
     
    392530            $sgrbDataArray['template-text-color'] = @$options["template-text-color"];
    393531            $sgrbDataArray['post-category'] = @$options["post-category"];
     532            // wooCommerce
     533            $sgrbDataArray['wooReviewShowType'] = @$options["wooReviewShowType"];
     534
     535            $sgrbDataArray['woo-category'] = @$options["woo-category"];
     536            $sgrbDataArray['woo-products'] = @$options["woo-products"];
     537            if ($sgrbDataArray['wooReviewShowType']) {
     538                if ($sgrbDataArray['wooReviewShowType'] == 'showByCategory') {
     539                    if ($sgrbDataArray['woo-category']) {
     540                        $sgrbDataArray['woo-category'] = json_decode($sgrbDataArray['woo-category']);
     541                    }
     542                }
     543            }
     544            $sgrbDataArray['disableWooComments'] = @$options["disableWooComments"];
     545            // wooCommerce
    394546            $sgrbDataArray['disableWPcomments'] = @$options["disableWPcomments"];
    395547            $sgrbDataArray['comments-count-to-show'] = @$options["comments-count-to-show"];
     
    437589        }
    438590        SGRB_AdminView::render('Review/save', array(
    439             'sgrbDataArray' => $sgrbDataArray,
    440             'sgrbSaveUrl' => $sgrbSaveUrl,
    441             'sgrbRevId' => $sgrbId,
    442             'sgrbRev' => $sgrbRev,
    443             'fields' => $fields,
    444             'ratings' => $ratings,
     591            'sgrbDataArray'  => $sgrbDataArray,
     592            'sgrbSaveUrl'    => $sgrbSaveUrl,
     593            'sgrbRevId'      => $sgrbId,
     594            'sgrbRev'        => $sgrbRev,
     595            'fields'         => $fields,
     596            'ratings'        => $ratings,
    445597            'allCommentsUrl' => $allCommentsUrl,
    446             'res' => $res,
    447             'allTemplates' => $allTemplates
     598            'res'            => $res,
     599            'allTemplates'   => $allTemplates,
     600            'termsArray'     => $termsArray,
     601            'allProductsCount'   => $allProductsCount,
     602            'productsArray'  => $productsArray,
     603            'categoriesArray'  => $categoriesArray,
     604            'allPageReviews' => $allPageReviews,
     605            'matchesProducts'=> $matchesProducts,
     606            'matchesCategories'=> $matchesCategories
    448607        ));
     608    }
     609
     610    public function ajaxWooProductLoad()
     611    {
     612        global $sgrb;
     613        global $wpdb;
     614        $allProductsString = '';
     615        $productsArray = array();
     616        $allPageReviews = array();
     617        $selectedProducts = array();
     618        $start = $_POST['start'];
     619        $reviewId = $_POST['reviewId'];
     620        $perPage = $_POST['perPage'];
     621
     622        $allPageReviews = SGRB_Page_ReviewModel::finder()->findAll('review_id <> %d', $reviewId);
     623
     624        if ($reviewId) {
     625            $review = SGRB_ReviewModel::finder()->findByPk($reviewId);
     626            if ($review) {
     627                $options = $review->getOptions();
     628                $options = json_decode($options, true);
     629                $selectedProducts = $options['woo-products'];
     630                $selectedProducts = json_decode($selectedProducts, true);
     631               
     632                foreach ($selectedProducts as $product => $value) {
     633                    if ($value == 0) {
     634                        unset($selectedProducts[$product]);
     635                    }
     636                }
     637            }
     638        }
     639       
     640        $allProducts = get_posts(array(
     641            'post_type'     => 'product',
     642            'numberposts'   => $perPage,
     643            'offset'        => $start
     644        ));
     645
     646        $matchProdArray = array();
     647        if ($allPageReviews) {
     648            for ($k=0;$k<count($allPageReviews);$k++) {
     649                $revId = $allPageReviews[$k]->getReview_id();
     650                if ($revId) {
     651                    $review = SGRB_ReviewModel::finder()->findByPk($revId);
     652                    if ($review) {
     653                        $reviewName = $review->getTitle();
     654                    }
     655                }
     656                $prodId = $allPageReviews[$k]->getProduct_id();
     657                $matchProdArray[$k]['id'] = $prodId;
     658                $matchProdArray[$k]['name'] = $reviewName;
     659            }
     660        }
     661
     662        if ($allProducts) {
     663            for ($i=0;$i<count($allProducts);$i++) {
     664                if ($selectedProducts) {
     665                    foreach ($selectedProducts as $key => $val) {
     666                        $productsArray[$i]['id'] = $allProducts[$i]->ID;
     667                        $productsArray[$i]['name'] = $allProducts[$i]->post_title;
     668                        $productsArray[$i]['checked'] = '';
     669                        $productsArray[$i]['checkedClass'] = 'sgrb-selected-products';
     670                        if ($selectedProducts[$productsArray[$i]['id']] == 1) {
     671                            $productsArray[$i]['checked'] = ' checked';
     672                            break;
     673                        }
     674                    }
     675                }
     676                else {
     677                    $productsArray[$i]['id'] = $allProducts[$i]->ID;
     678                    $productsArray[$i]['name'] = $allProducts[$i]->post_title;
     679                    $productsArray[$i]['checked'] = '';
     680                    $productsArray[$i]['checkedClass'] = '';
     681                }
     682                if (!empty($matchProdArray)) {
     683                    for ($k=0;$k<count($matchProdArray);$k++) {
     684                        $productsArray[$i]['matchProdId'] = '';
     685                        $productsArray[$i]['matchReview'] = '';
     686                        if ($productsArray[$i]['id'] == $matchProdArray[$k]['id']) {
     687                            $productsArray[$i]['matchProdId'] = ' disabled';
     688                            $productsArray[$i]['checkedClass'] = '';
     689                            $productsArray[$i]['matchReview'] = ' - <i class="sgrb-is-used">used in </i> '.$matchProdArray[$k]['name'].'<i class="sgrb-is-used"> review</i>';
     690                            break;
     691                        }
     692                    }
     693                }
     694                else {
     695                    $productsArray[$i]['matchProdId'] = '';
     696                    $productsArray[$i]['matchReview'] = '';
     697                }
     698            }
     699        }
     700
     701        $allProductsString = json_encode($productsArray);
     702
     703        echo $allProductsString;
     704        exit();
    449705    }
    450706
     
    473729        SGRB_CategoryModel::finder()->deleteAll('review_id = %d', $id);
    474730        SGRB_CommentModel::finder()->deleteAll('review_id = %d', $id);
     731        SGRB_Page_ReviewModel::finder()->deleteAll('review_id = %d', $id);
    475732        SGRB_ReviewModel::finder()->deleteByPk($id);
    476733        exit();
     
    531788    }
    532789
     790    // wooCommerce
     791    public function createWooReviewHtml ($review)
     792    {
     793        $arr = array();
     794        $title = $review->getTitle();
     795        $templateId = $review->getTemplate_id();
     796        $options = $review->getOptions();
     797        $template = SGRB_TemplateModel::finder()->findByPk($templateId);
     798        $arr['title'] = $title;
     799        $arr['id'] = $review->getId();
     800        $arr['template-id'] = $templateId;
     801        $arr['options'] = json_decode($options,true);
     802        $arr['template'] = $template;
     803        $sgrbDataArray[] = $arr;
     804        $html = $this->createReviewHtml($sgrbDataArray);
     805        return $html;
     806    }
     807
    533808    // create all review front
    534809    private function createReviewHtml($review, $isWidget=false)
     
    580855        $eachCategoryHide = '';
    581856        $isPostReview = false;
    582         if (is_singular('post') && !is_page() && SGRB_PRO_VERSION && ($mainTemplate->getName() == 'post_review')) {
     857        $currentPost = get_post();
     858        $currentPostId = $currentPost->ID;
     859        $currentPostType = $currentPost->post_type;
     860        if (is_singular('post') && !is_page() && SGRB_PRO_VERSION && ($mainTemplate->getName() == 'post_review') || ($mainTemplate->getName() == 'woo_review') || $currentPostType == 'product') {
    583861            $currentPost = get_post();
    584862            $postId = get_post()->ID;
     
    12691547            $commentForm .= '</div>';
    12701548        }
     1549        if (($mainTemplate->getName() == 'woo_review') || $currentPostType == 'product') {
     1550            $closeHtml = '';
     1551        }
    12711552        $html .= $closeHtml;
    12721553        return '<form class="sgrb-user-rate-js-form"><div id="sgrb-review-'.@$review[0]['id'].'" class="'.$sgrbWidgetWrapper.'">'.$html.'</div></div>'.$allApprovedComments.$commentForm.'</div></form>';
  • review-builder/trunk/com/controllers/Setup.php

    r1508588 r1519229  
    1010$sgrb->includeModel('Rate_Log');
    1111$sgrb->includeModel('TemplateDesign');
     12$sgrb->includeModel('Page_Review');
    1213
    1314class SGRB_SetupController extends SGRB_Controller
     
    2324        SGRB_Comment_RatingModel::create();
    2425        SGRB_Rate_LogModel::create();
     26        SGRB_Page_ReviewModel::create();
    2527        if (is_multisite()) {
    2628            $sites = wp_get_sites();
     
    3335                SGRB_Comment_RatingModel::create();
    3436                SGRB_Rate_LogModel::create();
     37                SGRB_Page_ReviewModel::create();
    3538            }
    3639        }
     
    5255        SGRB_CommentModel::drop();
    5356        SGRB_Rate_LogModel::drop();
     57        SGRB_Page_ReviewModel::drop();
    5458        if (is_multisite()) {
    5559            $sites = wp_get_sites();
     
    6266                SGRB_CommentModel::drop();
    6367                SGRB_Rate_LogModel::drop();
     68                SGRB_Page_ReviewModel::drop();
    6469
    6570            }
  • review-builder/trunk/com/core/SGRB.php

    r1513367 r1519229  
    6262        add_action('wp_enqueue_scripts', array($this, 'includeFrontScriptsAndStyles'));
    6363        add_action('media_buttons', array($this, 'sgrb_media_button'));
    64 
    6564        add_action('wp_head', array($this, 'sgrbCreateAjaxUrl'));
    6665        add_filter('the_content', array($this, 'showPostReview'));
     66        // start wooCommerce
     67        add_action('wp_head', array($this, 'woo_review_disable'));
     68        add_filter('woocommerce_product_tabs', array($this, 'woo_sgrb_product_tab'));
     69        // end wooCommerce
    6770        add_action('add_meta_boxes_post',array($this, 'meta_post_box'));
    6871        add_action('save_post', array($this, 'sgrbSelectPostReview'));
     
    7073    }
    7174
     75    public function woo_review_disable() {
     76        $this->includeController('Review');
     77        $html = '';
     78        $reviewId = 0;
     79        $selectedCategory = array();
     80        $reviewsArray = array();
     81
     82        $currentPost = get_post();
     83        $currentPostId = $currentPost->ID;
     84        $currentPostType = $currentPost->post_type;
     85
     86        if (($currentPostType == 'product') && !is_page() && SGRB_PRO_VERSION == 1) {
     87            $byProductReviews = SGRB_Page_ReviewModel::finder()->findAll('product_id = %d', $currentPostId);
     88            if ($byProductReviews) {
     89                foreach ($byProductReviews as $byProductReview) {
     90                    if ($byProductReview) {
     91                        $reviewId = $byProductReview->getReview_id();
     92                    }
     93                }
     94            }
     95            else {
     96                $currentProductCategories = get_the_terms($currentPostId, 'product_cat');
     97                if ($currentProductCategories) {
     98                    $lastCategoryIndex = max(array_keys($currentProductCategories));
     99                    $currentCat = $currentProductCategories[$lastCategoryIndex];
     100                    $currentCatId = $currentCat->term_id;
     101                    if ($currentCatId) {
     102                        $byProductCategoryReviews = SGRB_Page_ReviewModel::finder()->find('category_id = %d', $currentCatId);
     103                        $reviewId = $byProductCategoryReviews->getReview_id();
     104                    }
     105                }
     106            }
     107            if ($reviewId) {
     108                $review = SGRB_ReviewModel::finder()->findByPk($reviewId);
     109                if ($review) {
     110                    $options = $review->getOptions();
     111                    $options = json_decode($options, true);
     112                    $isDisabled = $options['disableWooComments'];
     113                    if ($isDisabled) {
     114                        add_filter('woocommerce_product_tabs', array($this, 'woo_remove_product_tabs'));
     115                    }
     116                }
     117            }
     118        }       
     119    }
     120
     121    public function woo_remove_product_tabs($tabs) {
     122        unset($tabs['reviews']);
     123        return $tabs;
     124    }
     125
     126    public function woo_sgrb_product_tab($tabs) {
     127        // Adds the new tab
     128        $currentPost = get_post();
     129        $currentPostId = $currentPost->ID;
     130        $byProductCategoryReviews = '';
     131        $byProductReviews = SGRB_Page_ReviewModel::finder()->findAll('product_id = %d', $currentPostId);
     132        $currentProductCategories = get_the_terms($currentPostId, 'product_cat');
     133        if ($currentProductCategories) {
     134            $lastCategoryIndex = max(array_keys($currentProductCategories));
     135            $currentCat = $currentProductCategories[$lastCategoryIndex];
     136            $currentCatId = $currentCat->term_id;
     137            if ($currentCatId) {
     138                $byProductCategoryReviews = SGRB_Page_ReviewModel::finder()->find('category_id = %d', $currentCatId);
     139            }
     140        }
     141
     142        if (!empty($byProductReviews) || $byProductCategoryReviews) {
     143            $tabs['sgrb_tab'] = array(
     144                'title'     => __( 'Add reviews', 'woocommerce' ),
     145                'priority'  => 50,
     146                'callback'  => array($this, 'woo_sgrb_product_tab_content')
     147            );
     148        }
     149       
     150        return $tabs;
     151
     152    }
     153    public function woo_sgrb_product_tab_content() {
     154        // The new tab content
     155        $this->includeController('Review');
     156        $html = '';
     157        $reviewId = 0;
     158        $selectedCategory = array();
     159        $reviewsArray = array();
     160
     161        $currentPost = get_post();
     162        $currentPostId = $currentPost->ID;
     163        $currentPostType = $currentPost->post_type;
     164        $allTerms = get_terms(array('get' => 'all'));
     165        foreach ($allTerms as $term) {
     166            if (get_term_meta($term->term_id)) {
     167                if ($term->term_id == $currentPostId) {
     168                    $termsArray['id'][] = $term->term_id;
     169                    $termsArray['name'][] = $term->name;
     170                }
     171            }
     172        }
     173
     174        if (($currentPostType == 'product') && !is_page() && SGRB_PRO_VERSION == 1) {
     175            $byProductReviews = SGRB_Page_ReviewModel::finder()->findAll('product_id = %d', $currentPostId);
     176            if ($byProductReviews) {
     177                foreach ($byProductReviews as $byProductReview) {
     178                    if ($byProductReview) {
     179                        $reviewId = $byProductReview->getReview_id();
     180                    }
     181                }
     182                if ($reviewId) {
     183                    $review = SGRB_ReviewModel::finder()->findByPk($reviewId);
     184                    if ($review) {
     185                        $rev = new SGRB_ReviewController();
     186                        $html = $rev->createWooReviewHtml($review);
     187                    }
     188                }
     189            }
     190            else {
     191                $currentProductCategories = get_the_terms($currentPostId, 'product_cat');
     192                if ($currentProductCategories) {
     193                    $lastCategoryIndex = max(array_keys($currentProductCategories));
     194                    $currentCat = $currentProductCategories[$lastCategoryIndex];
     195                    $currentCatId = $currentCat->term_id;
     196                    if ($currentCatId) {
     197                        $byProductCategoryReviews = SGRB_Page_ReviewModel::finder()->find('category_id = %d', $currentCatId);
     198                        $reviewId = $byProductCategoryReviews->getReview_id();
     199                        if ($reviewId) {
     200                            $review = SGRB_ReviewModel::finder()->findByPk($reviewId);
     201                            if ($review) {
     202                                $rev = new SGRB_ReviewController();
     203                                $html = $rev->createWooReviewHtml($review);
     204                            }
     205                        }
     206                    }
     207                }
     208            }
     209        }
     210        echo $html;
     211    }
     212
    72213    public function sgrbSetVersion()
    73214    {
    74215        $this->includeModel('TemplateDesign');
    75         $this->includeModel('Comment_Rating');
    76 
    77         $sgrbVersion = get_option('SGRB_VERSION');
    78         if ($sgrbVersion && $sgrbVersion <= '1.1.2') {
    79             SGRB_TemplateDesignModel::create();
    80             SGRB_Comment_RatingModel::alterTable();
    81             SGRB_Rate_LogModel::alterTable();
    82         }
    83 
     216        $this->includeModel('Comment_Rating');
     217
     218        $sgrbVersion = get_option('SGRB_VERSION');
     219        if ($sgrbVersion && $sgrbVersion <= '1.1.2') {
     220            SGRB_TemplateDesignModel::create();
     221            SGRB_Comment_RatingModel::alterTable();
     222            SGRB_Rate_LogModel::alterTable();
     223        }
    84224        if($sgrbVersion < SGRB_VERSION) update_option('SGRB_VERSION', SGRB_VERSION);
    85225    }
     
    93233    public function sgrb_media_button()
    94234    {
     235        $currentPost = get_post();
     236        $currentPostId = $currentPost->ID;
     237        $currentPostType = $currentPost->post_type;
     238        if ($currentPostType == 'product') {
     239            return;
     240        }
    95241        $buttonTitle = "Insert review";
    96242        $output = '';
     
    193339            }
    194340        }
    195         return $content;
    196 
     341        return $content;       
     342       
    197343    }
    198344
     
    414560        }
    415561        wp_enqueue_script($this->prefix.$script, $this->asset($script.'.js'), array('jquery'),false);
    416     }
     562    }   
    417563
    418564    public function includeStyle($style)
  • review-builder/trunk/com/layouts/Review/save.php

    r1513332 r1519229  
    44    $sgrb->includeScript('core/scripts/jquery-ui-dialog');
    55    $allTags = get_tags();
    6 ;?>
     6    $allTerms = get_categories();
     7?>
    78
    89<div class="wrap">
     
    2930        <div class="sgrb-main-container">
    3031            <div class="sg-row">
    31 
    3232                <div class="sg-col-8">
    33                     <div class="sg-box sgrb-template-post-box"<?php echo (@$sgrbDataArray['template'] == 'post_review') ? ' style="min-height:150px;"' : '';?>>
     33                    <div class="sg-box sgrb-template-post-box"<?php echo ((@$sgrbDataArray['template'] == 'post_review') || (@$sgrbDataArray['template'] == 'woo_review')) ? ' style="min-height:150px;"' : '';?>>
    3434                        <div class="sg-box-title"><?php echo _e('General', 'sgrb');?></div>
    3535                        <div class="sg-box-content">
    3636                            <div class="sgrb-main-template-wrapper"><?php echo (@$sgrbDataArray['template'] != 'post_review') ? @$res : '';?></div>
     37<!-- Post review template -->
    3738                            <div class="sgrb-post-template-wrapper"<?php echo (@$sgrbDataArray['template'] == 'post_review') ? '' : ' style="display:none;"';?>>
    3839                                <div class="sg-row">
     
    4243                                    <div class="sg-col-8">
    4344                                        <select class="sgrb-post-category" name="post-category">
    44                                             <?php foreach (get_terms(array('get'=> 'all')) as $postCategory) :?>
     45                                            <?php foreach ($allTerms as $postCategory) :?>
    4546                                                <option value="<?php echo $postCategory->term_id;?>"<?php echo (@$sgrbDataArray['post-category'] == $postCategory->term_id) ? ' selected': '';?>><?php echo $postCategory->name?></option>
    4647                                            <?php endforeach;?>
     
    5758                                <div class="sg-row">
    5859                                    <div class="sg-col-6">
    59                                         <p class="sgrb-type-warning">This review will only be shown in posts with selected category</p>
    60                                     </div>
    61                                 </div>
    62                             </div>
     60                                        <p class="sgrb-type-warning"><?php echo _e('This review will only be shown in posts with selected category', 'sgrb');?></p>
     61                                    </div>
     62                                </div>
     63                            </div>
     64<!-- end-->
     65
     66<!-- WooCommerce review template -->
     67                            <div class="sgrb-woo-template-wrapper"<?php echo (@$sgrbDataArray['template'] == 'woo_review') ? '' : ' style="display:none;"';?>>
     68                                <div class="sg-row">
     69                                    <div class="sg-col-5">
     70                                        <label for="wooReviewShowType"><input id="wooReviewShowType" type="radio" value="showByCategory" name="wooReviewShowType"<?php echo (@$sgrbDataArray['wooReviewShowType'] == 'showByCategory' || !@$_GET['id']) ? ' checked' : '' ;?>><?php echo _e('Show review on products with selected categories', 'sgrb');?></label>
     71                                    </div>
     72                                </div>
     73                                <div class="sg-row">
     74                                    <div class="sg-col-6">
     75                                        <div class="sgrb-woo-categories-select-all"<?php echo (@$sgrbDataArray['wooReviewShowType'] != 'showByCategory') ? ' style="display:none;"' : '' ;?>>
     76                                            <div class="sgrb-select-checkbox">
     77                                                <input type="checkbox" class="sgrb-select-all-categories">
     78                                            </div>
     79                                        </div>
     80                                        <div class="sgrb-woo-category-wrapper"<?php echo (@$sgrbDataArray['wooReviewShowType'] != 'showByCategory') ? ' style="display:none;"' : '' ;?>>
     81                                        <?php if (empty($termsArray)):?>
     82                                        <div class="sgrb-each-category-wrapper">
     83                                            <span class="sgrb-woo-product-category-name"><?php echo _e('No product categories found', 'sgrb');?></span>
     84                                        </div>
     85                                        <?php else :?>
     86                                            <?php for ($i=0;$i<count(@$termsArray['id']);$i++) :?>
     87                                                <?php $categoryClass = 'sgrb-selected-categories';?>
     88                                                <div class="sgrb-each-category-wrapper">
     89                                                    <label for="sgrb-woo-category-<?=$termsArray['id'][$i];?>">
     90                                                    <?php for ($j=0;$j<count(@$sgrbDataArray['woo-category']);$j++) :?>
     91                                                        <?php $checked = '';?>
     92                                                        <?php $disabled = '';?>
     93                                                       
     94                                                        <?php $categoryClass = 'sgrb-selected-categories';?>
     95                                                        <?php if (@$termsArray['id'][$i] == @$sgrbDataArray['woo-category'][$j]) :?>
     96                                                            <?php $checked = ' checked';?>
     97                                                            <?php break;?>
     98                                                        <?php endif;?>
     99                                                    <?php endfor;?>
     100                                                    <?php for ($k=0;$k<count(@$matchesCategories['id']);$k++) :?>
     101                                                        <?php $matchReview = '';?>
     102                                                        <?php $disabled = '';?>
     103                                                        <?php if (@$matchesCategories['id'][$k] == @$termsArray['id'][$i]) :?>
     104                                                            <?php $checked = '';?>
     105                                                            <?php $disabled = ' disabled';?>
     106                                                            <?php $categoryClass = '';?>
     107                                                            <?php $matchReview = ' - <i class="sgrb-is-used">used in </i> '.@$matchesCategories['review'][$k].'<i class="sgrb-is-used"> review</i>';?>
     108                                                            <?php break;?>
     109                                                        <?php endif;?>
     110                                                    <?php endfor;?>
     111                                                        <input class="sgrb-woo-category <?=$categoryClass?>" id="sgrb-woo-category-<?=@$termsArray['id'][$i];?>" type="checkbox" value="<?php echo @$termsArray['id'][$i];?>" <?php echo @$checked.' '.@$disabled;?>>
     112                                                        <span class="sgrb-woo-product-category-name"><?php echo @$termsArray['name'][$i]?><?php echo @$matchReview?></span>
     113                                                    </label>
     114                                                </div>
     115                                            <?php endfor;?>
     116                                        <?php endif;?>
     117                                        </div>
     118                                    </div>
     119                                </div>
     120                                <div class="sg-row">
     121                                    <div class="sg-col-4">
     122                                        <label for="wooReviewShowTypeProduct"><input id="wooReviewShowTypeProduct" type="radio" value="showByProduct" name="wooReviewShowType"<?php echo (@$sgrbDataArray['wooReviewShowType'] == 'showByProduct') ? ' checked' : '' ;?>><?php echo _e('Show review on selected products', 'sgrb');?></label>
     123                                    </div>
     124                                </div>
     125                                <div class="sg-row">
     126                                    <div class="sg-col-6">
     127                                        <div class="sgrb-woo-products-select-all"<?php echo (@$sgrbDataArray['wooReviewShowType'] != 'showByProduct') ? ' style="display:none;"' : '' ;?>>
     128                                            <div class="sgrb-select-checkbox">
     129                                                <input type="checkbox" class="sgrb-select-all-products">
     130                                                <span><?php echo _e('Products to load:', 'sgrb');?> <input name="productsToLoad" maxlength="3" value="500" type="text"></span>
     131                                            </div>
     132                                        </div>
     133                                        <div class="sgrb-woo-products-wrapper"<?php echo (@$sgrbDataArray['wooReviewShowType'] != 'showByProduct') ? ' style="display:none;"' : '' ;?>>
     134                                            <div class="sgrb-load-more-woo">
     135                                                <input class="button-small button sgrb-products-selector" value="<?php echo _e('Loading...', 'sgrb');?>" type="button">
     136                                            </div>
     137                                        </div>
     138                                    </div>
     139                                </div>
     140                                <input type="hidden" class="sgrb-all-products-categories" name="allProductsCategories" value="<?php echo @$sgrbDataArray['woo-products'];?>">
     141                                <input type="hidden" class="sgrb-all-products-count" name="allProductsCount" value="<?php echo @$allProductsCount;?>">
     142                                <div class="sg-row sgrb-disable-woo-comments-wrapper">
     143                                    <div class="sg-col-6">
     144                                        <label for="sgrb-disable-woo-comments">
     145                                            <input id="sgrb-disable-woo-comments" value="true" type="checkbox" name="disableWooComments"<?php echo (@$sgrbDataArray['disableWooComments']) ? ' checked' : '';?>> <?php echo _e('Disable WooCommerce products default reviews and comments', 'sgrb');?>
     146                                        </label>
     147                                         <p class="sgrb-type-warning"><?php echo _e('Note: if the product has more than one review, priority will be given to the review attached directly to the product.', 'sgrb');?></p>
     148                                    </div>
     149                                </div>
     150                            </div>
     151<!-- end-->
    63152                        </div>
    64153                    </div>
     
    324413                                        <input class="sgrb-fieldId" name="fieldId[]" type="hidden" value="0">
    325414                                        <p>
    326                                             <input name="field-name[]" type="text" value="" placeholder="<?php echo _e('e.g quality/speed/price of review item', 'sgrb');?>" class="sgrb-field-name">
     415                                            <input name="field-name[]" type="text" value="" placeholder="<?php echo _e('e.g. quality/speed/price of review item', 'sgrb');?>" class="sgrb-field-name">
    327416                                            <a class="button-secondary sgrb-remove-button" onclick="SGRB.remove('clone_1')"><span class="sgrb-dashicon dashicons dashicons-trash button-icon"></span> Remove</a>
    328417                                        </p>
     
    337426                                        <input class="sgrb-fieldId" name="fieldId[]" type="hidden" value="<?php echo esc_attr(@$field->getId());?>">
    338427                                    <p>
    339                                         <input<?php echo (@$sgrbRevId != 0) ? ' readonly' : '';?> name="field-name[]" type="text" value="<?php echo esc_attr(@$field->getName());?>"placeholder="<?php echo _e('e.g quality/speed/price of review item', 'sgrb');?>" class="sgrb-border sgrb-field-name">
     428                                        <input<?php echo (@$sgrbRevId != 0) ? ' readonly' : '';?> name="field-name[]" type="text" value="<?php echo esc_attr(@$field->getName());?>"placeholder="<?php echo _e('e.g. quality/speed/price of review item', 'sgrb');?>" class="sgrb-border sgrb-field-name">
    340429                                        <a class="button-secondary sgrb-remove-button" onclick="SGRB.remove(<?php echo esc_attr(@$field->getId());?>)"><span class="sgrb-dashicon dashicons dashicons-trash button-icon"></span> Remove</a>
    341430                                    </p>
  • review-builder/trunk/com/models/Rate_Log.php

    r1513390 r1519229  
    2727                      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    2828                      `review_id` int(10) unsigned NOT NULL,
    29                       `comment_id` INT(10) UNSIGNED NULL,
     29                      `comment_id` INT(10) unsigned NULL,
    3030                      `post_id` INT(10) NULL,
    3131                      `ip` varchar(255) NOT NULL,
     
    4141        $tablename = $sgrb->tablename(self::TABLE);
    4242
    43         $query = "ALTER TABLE $tablename ADD `comment_id` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `review_id`;";
     43        $query = "ALTER TABLE $tablename ADD `comment_id` INT(10) unsigned NULL DEFAULT NULL AFTER `review_id`;";
    4444        $wpdb->query($query);
    4545    }
  • review-builder/trunk/com/models/TemplateDesign.php

    r1487981 r1519229  
    6767        $wpdb->query($insertQuery24);
    6868        $wpdb->query($insertQuery25);
     69        $wpdb->query($insertQuery26);
    6970    }
    7071
  • review-builder/trunk/readme.txt

    r1513332 r1519229  
    11=== Review ===
    22Plugin Name: Review
    3 Version: 1.1.6
     3Version: 1.1.7
    44Donate link: http://plugins.sygnoos.com/wordpress-review-builder/
    55URI: http://plugins.sygnoos.com/wordpress-review-builder/
     
    4343#### PRO Features:
    4444* Google SEO integration
     45* WooCommerce product review
    4546* 15 More Templates
    4647* Customize templates
     
    128129== Changelog ==
    129130
     131= 1.1.7 =
     132* Added support for woocommerce product review (PRO).
     133* Code optimization and bug fixes.
     134
    130135= 1.1.6 =
    131136* Added placeholders for inputs.
     
    156161* Bug fixed connected to comments.
    157162* Bug fixed connected to ratings.
    158 * Minor bug fixes.
    159 
    160 = 1.0.9 =
    161 * Bug fixed connected to reviewer comments.
    162 
    163 = 1.0.8 =
    164 * Stability improvements.
    165 * Now template image can be removed.
    166 * Bug fixed connected to template fields.
    167 * Widget added.
    168 
    169 = 1.0.7 =
    170 * Add asteriksts for required fields.
    171 * Stability improvements.
    172 * Show/Hide all comments.
    173 
    174 = 1.0.6 =
    175 * Mobile view bug fixed.
    176 * Desktop view bug fixed.
    177 
    178 = 1.0.5 =
    179 * Bug fixed.
    180 
    181 = 1.0.4 =
    182 * Stability improvements.
    183 
    184 = 1.0.3 =
    185 * Bug fixes.
    186 
    187 = 1.0.2 =
    188 * Bug fixes.
    189 
    190 = 1.0.1 =
    191 * Bug fixes.
    192 * New templates.
    193 
    194 = 1.0 =
    195 * Initial Commit.
    196 
    197 == Upgrade Notice ==
    198 
    199 Current version of Review Builder is v1.1.6
    200 
    201 == Other Notes ==
    202 
    203 **Reviews**
    204 
    205 In general, reviews are evaluations of a publication, service, or a company. Nowadays, reviews are a very important piece of software. People want their services, products be evaluated, in other words, they want them to be reviewed. In this way users express their opinion concerning the product or the service they had experienced. "Star" ratings are very common in online services. You buy a product, or use a service and then you can easily express your feelings about the product/service just giving them stars (usually one to five stars). You can even express your thoughts and write a brief evaluating text right under the rating. Reviewing is actually a great thing now, for customers especially. Before making a purchase you can have a look at the product/service reviews and decide on buying it or not. As customer reviews generally form the most fear and true description of a product/service.
    206 
    207 **Design your own Reviews Section**
    208 
    209 If you have a website and need to add reviews' section to it, you can do that with the help of this plugin. You can show your users that you care about their opinion adding a reviews' section to your site. You can make up your own reviews' section, all by your own! We all know that design is one of the most important components of anything! Reviews section is not an exception. It should be well-organized and you should take in count every single detail to attract the customer and not to be try too hard to make it vulgar. Select the colors to be eye catching and at the same time fitting each other. Actually it's pretty hard not to cross the line when you see so many options of color settings and themes and all the rest. So, be careful and don't miss any detail. Organize the whole design and set up all the little details of your reviews' section. Set up the stars color, set how many stars you want to be rated, for instance, you can set up max 3 stars instead of usual 5 stars. You can add images of your products and services to be rated.
    210 
    211 **Make it organized**
    212 
    213 Reviews of your product or service that you offer should be organized full of valuable keywords directly related to your business. One more important thing to consider, if a page has one or two reviews a day, it's said to be a fresh one. This is because if a product/service is reviewed often it means people use it much and the developer, from his side, keeps updating and making it better every day.
    214 
    215 **Control the reviews**
    216 
    217 Besides, with Review Builder you have full control over your reviews, showing only the reviews you want visitors to read, making sure your website is optimized for an increase in sales. This is a really great feature, as there are often spammers who leave bad reviews just to make your sales worse. That's why it's important to have control over the reviews left for your products/services, which you can have with this plugin.
    218 So, if you're confident in your products, go ahead and open your site to ratings from customers! Add a reviews section to your website and give your customers an opportunity to review your products/services, and, why not, they might even leave some notes that you  might have not noticed. Make your sales better and your website more cutomer-friendly!
     163* Min
  • review-builder/trunk/sql/templates_sql.php

    r1497024 r1519229  
    2525    $insertQuery24 = "INSERT INTO $tablename VALUES (24,'two_boxes',1,'".$path."two_boxes.jpeg','<div class=\"sg-template-wrapper\">\r\n<div class=\"sg-row\">\r\n<div class=\"sg-col-12\">\r\n<div class=\"sg-tempo-title\">\r\n[sgrbtitle]\r\n</div>\r\n</div>\r\n</div>\r\n<div class=\"sg-row\">\r\n<div class=\"sg-col-6\">\r\n<div class=\"sg-template-box\">\r\n<div class=\"sg-tempo-image\">\r\n[sgrbimg]\r\n</div>\r\n<div class=\"sg-tempo-title-second\">\r\n[sgrbsubtitle]\r\n</div>\r\n</div>\r\n</div>\r\n<div class=\"sg-col-6\">\r\n<div class=\"sg-template-box\">\r\n<div class=\"sg-tempo-image\">\r\n[sgrbimg]\r\n</div>\r\n<div class=\"sg-tempo-title-second\">\r\n[sgrbsubtitle]\r\n</div>\r\n</div>\r\n</div>\r\n</div>\r\n<div class=\"sg-row\">\r\n<div class=\"sg-col-12\">\r\n<div class=\"sg-template-box\">\r\n<div class=\"sg-tempo-context sg-temp-field-full-height\">\r\n[sgrblongdescription]\r\n</div>\r\n</div>\r\n</div>\r\n</div>\r\n</div>','.sg-template-wrapper {\r\n    width: 100%;\r\n    padding: 10px;\r\n  box-sizing: border-box;\r\n}\r\n\r\n.sg-template-box {\r\n  display: inline-block;\r\n  min-height: 30px;\r\n   width: 100%;\r\n    overflow: hidden;\r\n}\r\n\r\n.sg-tempo-image {\r\n width: 98%;\r\n overflow: hidden;\r\n   height: 250px;\r\n}\r\n\r\n.sg-tempo-title {\r\n    width: 100%;\r\n    height: 50px;\r\n   display: inline-block;\r\n  margin-bottom: 10px;\r\n    border: 1px solid rgb(223, 223, 223);\r\n   border-radius: 3px;\r\n text-align: center;\r\n font-size: 1.4em;\r\n   font-weight: bold;\r\n  background-color: #ffffff;\r\n  box-sizing: border-box;\r\n padding: 5px;\r\n   overflow: hidden;\r\n}\r\n\r\n.sg-tempo-title-second {\r\n  width: 100%;\r\n    height: 30px;\r\n   display: inline-block;\r\n  margin-top: 10px;\r\n   border: 1px solid rgb(223, 223, 223);\r\n   border-radius: 3px;\r\n background-color: #ffffff;\r\n  box-sizing: border-box;\r\n padding: 0 5px;\r\n overflow: hidden;\r\n}\r\n\r\n.sg-tempo-context {\r\n   width: 100%;\r\n    min-height: 20px;\r\n   display: inline-block;\r\n  overflow: auto;\r\n padding: 10px;\r\n  border: 1px solid rgb(250, 250, 250);\r\n   background-color: #ffffff;\r\n  box-sizing: border-box;\r\n}\r\n\r\n.sgrb-icon-wrapper {\r\n    left: 35% !important;\r\n   top: 35% !important;\r\n}\r\n')";
    2626    $insertQuery25 = "INSERT INTO $tablename VALUES (25,'post_review',0,'".$path."post_review.jpeg','','')";
     27    $insertQuery26 = "INSERT INTO $tablename VALUES (26,'woo_review',0,'".$path."woo_review.jpeg','','')";
    2728?>
Note: See TracChangeset for help on using the changeset viewer.