var prow = '<tr id="trp-' + ref + '" class="trp-' + id + '"><td width="100px" class="strong">' + groupTitle + '</td></tr>' + pitemsInput;
     
    // if the group already exists, remove it before adding
    $("#simpleOptionsTable tr td:contains('" + groupTitle + "')").each(function() {
      $(this).closest('tr').remove();
    });
    // also remove it on the pricing table
    $(".simple-options-pricing-table tr td:contains('" + groupTitle + "')").each(function() {
      $(this).closest('tr').remove();
      $('.trp-' + id).remove();
    });   
    //          
    $('#simpleOptionsTable > tbody').append(row);
    
    var customerGroups = <?php 
echo json_encode(lC_Customer_groups_Admin::getAll());
?>
; 
    $.each(customerGroups.entries, function(key, val) { 
      
      var noOptions = $("#tbody-simple-options-pricing-" + val.customers_group_id).length;
      if (noOptions == 0) {
        $('#no-options-' + val.customers_group_id).remove();
        var pTable = '<div class="simple-options-pricing-container">' +
                     '  <div class="big-text underline margin-top" style="padding-bottom:8px;"><?php 
echo $lC_Language->get('text_simple_options');
?>
</div>' +
                     '  <table class="simple-table simple-options-pricing-table">' +
                     '    <tbody id="tbody-simple-options-pricing-' + val.customers_group_id + '"></tbody>' +
                     '  </table>' +
 public static function batchDelete($batch)
 {
     global $lC_Language, $lC_Database;
     $lC_Language->loadIniFile('customer_groups.php');
     $Qgroups = $lC_Database->query('select customers_group_id, customers_group_name from :table_customers_groups where customers_group_id in (":customers_group_id") and language_id = :language_id order by customers_group_name');
     $Qgroups->bindTable(':table_customers_groups', TABLE_CUSTOMERS_GROUPS);
     $Qgroups->bindRaw(':customers_group_id', implode('", "', array_unique(array_filter(array_slice($batch, 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric'))));
     $Qgroups->bindInt(':language_id', $lC_Language->getID());
     $Qgroups->execute();
     $names_string = '';
     while ($Qgroups->next()) {
         $Qcustomers = $lC_Database->query('select count(*) as total from :table_customers where customers_group_id = :customers_group_id');
         $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS);
         $Qcustomers->bindInt(':customers_group_id', $Qgroups->valueInt('customers_group_id'));
         $Qcustomers->execute();
         if ($Qcustomers->valueInt('total') > 0 || $Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID) {
             if ($Qcustomers->valueInt('total') > 0) {
                 $names_string .= $Qgroups->value('customers_group_name') . ' (' . $Qcustomers->valueInt('total') . ' ' . $lC_Language->get('customers') . '), ';
             }
             if ($Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID) {
                 $names_string .= $Qgroups->value('customers_group_name') . ' (' . $lC_Language->get('default') . ') ,';
             }
         } else {
             lC_Customer_groups_Admin::delete($Qgroups->valueInt('customers_group_id'));
         }
         $Qcustomers->freeResult();
     }
     if (!empty($names_string)) {
         $names_string = substr($names_string, 0, -2);
     }
     $result['namesString'] = $names_string;
     $Qgroups->freeResult();
     return $result;
 }
Exemple #3
0
 public static function getSpecialPricingContent()
 {
     global $lC_Language, $lC_Currencies, $pInfo;
     $content = '';
     $groups = lC_Customer_groups_Admin::getAll();
     foreach ($groups['entries'] as $key => $value) {
         if ($value['customers_group_id'] == 1) {
             // remove this line when specials per group is reintroduced
             $base = isset($pInfo) ? (double) $pInfo->get('products_price') : 0.0;
             $special = isset($pInfo) ? (double) $pInfo->get('products_special_price') : 0.0;
             $discount = isset($base) && $base > 0.0 ? round(($base - $special) / $base * 100, DECIMAL_PLACES) : 0.0;
             $content .= '<!--<label for="products_special_pricing_enable' . $value['customers_group_id'] . '" class="label margin-right"><b>' . $value['customers_group_name'] . '</b></label>-->' . '<div class="columns">' . '  <div class="new-row-mobile twelve-columns twelve-columns-mobile mid-margin-bottom">' . '    <input id="products_special_pricing_enable' . $value['customers_group_id'] . '" name="products_special_pricing_enable' . $value['customers_group_id'] . '" type="checkbox" class="margin-right medium switch"' . ($pInfo->get('products_special_status') != 0 && $value['customers_group_id'] == '1' ? ' checked' : '') . ' />' . '    <div class="inputs' . ($value['customers_group_id'] == '1' ? '' : ' disabled grey') . '" style="display:inline; padding:8px 0;">' . '      <span class="mid-margin-left no-margin-right">' . $lC_Currencies->getSymbolLeft() . '</span>' . '      <input type="text" onfocus="this.select();" onchange="updatePricingDiscountDisplay();" name="products_special_price[' . $value['customers_group_id'] . ']" id="products_special_price' . $value['customers_group_id'] . '" value="' . ($value['customers_group_id'] == '1' ? number_format($pInfo->get('products_special_price'), DECIMAL_PLACES) : '0.00') . '" class="sprice input-unstyled small-margin-right' . ($value['customers_group_id'] == '1' ? '' : ' grey disabled') . '" style="width:60px;"' . ($value['customers_group_id'] == '1' ? '' : ' READONLY') . '/>' . '    </div>' . '    <small class="input-info mid-margin-left no-wrap">' . $lC_Language->get('text_special_price') . ($value['customers_group_id'] == '1' ? '<span class="disctag tag glossy mid-margin-left">-' . number_format($discount, DECIMAL_PLACES) . '%</span>' : '') . '</small>' . '  </div>' . '  <div class="new-row-mobile twelve-columns twelve-columns-mobile">' . '    <span class="nowrap margin-right">' . '      <span class="input small-margin-top">' . '        <input name="products_special_start_date[' . $value['customers_group_id'] . ']" id="products_special_start_date' . $value['customers_group_id'] . '" type="text" placeholder="Start" class="input-unstyled datepicker' . ($value['customers_group_id'] == '1' ? '' : ' disabled') . '" value="' . $pInfo->get('products_special_start_date') . '" style="width:97px;" />' . '      </span>' . '      <span class="icon-calendar icon-size2 small-margin-left"></span>' . '    </span>' . '    <span class="nowrap">' . '      <span class="input small-margin-top">' . '        <input name="products_special_expires_date[' . $value['customers_group_id'] . ']" id="products_special_expires_date' . $value['customers_group_id'] . '" type="text" placeholder="End" class="input-unstyled datepicker' . ($value['customers_group_id'] == '1' ? '' : ' disabled') . '" value="' . $pInfo->get('products_special_expires_date') . '" style="width:97px;" />' . '      </span>' . '      <span class="icon-calendar icon-size2 small-margin-left"></span>' . '    </span>' . '  </div>' . '</div>';
         }
         // remove this line when specials per group is reintroduced
     }
     return $content;
 }
Exemple #4
0
 public static function batchDelete()
 {
     $result = lC_Customer_groups_Admin::batchDelete($_GET['batch']);
     if (isset($result['namesString']) && $result['namesString'] != null) {
     } else {
         $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     }
     echo json_encode($result);
 }