Plugin Directory

Changeset 2113688


Ignore:
Timestamp:
06/27/2019 03:13:12 PM (7 years ago)
Author:
reality66
Message:

Fix product dropdown in shortcode popup

Location:
cart66-cloud/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cart66-cloud/trunk/cart66-cloud.php

    r2108304 r2113688  
    44Plugin URI: http://cart66.com
    55Description: Secure Ecommerce For WordPress.
    6 Version: 2.3.0
     6Version: 2.3.1
    77Author: Reality66
    88Author URI: http://www.reality66.com
  • cart66-cloud/trunk/readme.txt

    r2108304 r2113688  
    66Requires PHP: 5.4
    77Tested up to: 5.2.1
    8 Stable tag: 2.3.0
     8Stable tag: 2.3.1
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    139139== Changelog ==
    140140
     141= 2.3.1 =
     142- Fix: Issue with product selection when inserting shortcode into page from the
     143  WordPress admin
     144
    141145= 2.3.0 =
    142146- Fix: Issue with product catalog showing incorrect prices for products
  • cart66-cloud/trunk/views/html-editor-pop-up.php

    r1687253 r2113688  
    88</style>
    99
     10<style type="text/css">
     11    .choices .choices__inner {
     12        min-height: auto;
     13        padding-right: 0;
     14        width: 90%;
     15    }
     16
     17    .choices .choices__list--single {
     18        width: 90%;
     19    }
     20
     21    .choices .choices__item--selectable {
     22        width: 90%;
     23    }
     24
     25    .choices[data-type*=select-one]:after {
     26        right: 35px;
     27    }
     28
     29    .choices .choices__list--dropdown {
     30        width: 93%;
     31    }
     32</style>
     33
    1034<script type="text/javascript">
    1135    function cc_insert_product_shortcode(){
    12         var product_info = JSON.parse(jQuery('#cc_product_id').val());
     36        var product_sku = jQuery('#cc_product_sku').val();
    1337        var display_type = jQuery("#display_type").val();
    1438        var display_quantity = jQuery("#display_quantity").is(":checked") ? 'true' : 'false';
    1539        var display_price = jQuery("#display_price").is(":checked") ? 'true' : 'false';
    1640
    17         if(product_info.length == 0 || product_info == "0" || product_info == ""){
     41        if(product_sku.length == 0 || product_sku == "0" || product_sku == ""){
    1842            alert("<?php _e("Please select a product", "cart66") ?>");
    1943            return;
    2044        }
    21         console.log(product_info);
    22         window.send_to_editor("[cc_product sku=\"" + product_info.sku + "\" display=\"" + display_type + "\" quantity=\"" + display_quantity + "\" price=\"" + display_price + "\"]");
     45        console.log(product_sku);
     46        window.send_to_editor("[cc_product sku=\"" + product_sku + "\" display=\"" + display_type + "\" quantity=\"" + display_quantity + "\" price=\"" + display_price + "\"]");
    2347    }
    2448
    25     jQuery(document).ready(function($) {
    26         $('#cc_product_id').select2({
    27             width: '100%',
    28             minimumInputLength: 2,
    29             allowClear: true,
    30             ajax: {
    31                 url: ajaxurl,
    32                 dataType: 'json',
    33                 data: function (term, page) {
    34                     return {
    35                         action: 'cc_ajax_product_search',
    36                         search: term
    37                     };
    38                 },
    39                 results: function (data, page) {
    40                   return { results: data };
    41                 }
    42             }
    43         });
    44     });
    4549</script>
     50
     51<?php
     52    $cloud_product = new CC_Cloud_Product();
     53    $cc_products = $cloud_product->get_products();
     54?>
    4655
    4756<div id="cc_editor_pop_up" style="display:none;">
     
    5766                    <tbody>
    5867                        <tr valign="top">
    59                             <th scope="row"><label for="cc_product_id">Products</label></th>
     68                            <th scope="row"><label for="cc_product_sku">Products</label></th>
    6069                            <td>
    61                                 <input type="hidden" name="cc_product_id" id="cc_product_id" value="" />
     70                                <select name="cc_product_sku" id="cc_product_sku" class="choices">
     71                                    <option placeholder value="">Choose Product</option>
     72                                    <?php foreach ($cc_products as $cc_product): ?>
     73                                        <option value="<?php echo $cc_product["sku"] ?>">
     74                                            <?php echo $cc_product["name"] ?>
     75                                        </option>
     76                                    <?php endforeach ?>
     77                                </select>
    6278                            </td>
    6379                        </tr>
     
    102118    </div>
    103119</div>
     120
     121<script>
     122    $(document).ready(function() {
     123        var choices = new Choices($(".choices")[0], {
     124        });
     125    });
     126</script>
Note: See TracChangeset for help on using the changeset viewer.