Zen Follower
- Join Date:
- Sep 2013
- Location:
- Texas
- Posts:
- 315
- Plugin Contributions:
- 0
Support Thread: Checkbox Textbox Icon Addon for Listings
Thanks for the update,
Views: 26,281
Zen Follower
Thanks for the update,
Totally Zenned
Okay, unfortunately the updates provided a while back have not made it to the website yet, so I thought I would provide at least the update(s) necessary to allow the installer to function for those that might be interested but deterred because of the mistakes I made when I rushed the upload.
prior to uploading, if you modify following lines of the file: Installation_files\YOUR_ADMIN\includes\init_includes\init_cb_txtb_icon_install.php
(These edits are provided in reverse order so that the line numbers provided will match with version 1.0.1 of the downloaded file.)
Replace line 326:
xxxx_overwrite_create_menu_item($menu_item[0],$menu_item[1],$menu_item[2],$pl_configuration_id,$menu_item[3]);
With:
xxxx_create_menu_item($menu_item[0],$menu_item[1],$menu_item[2],$pl_configuration_id,$menu_item[3]);
Replace Line 108:
array('PRODUCT_LIST_PRICE_BUY_NOW','no',20,array('0', '1', '2', '3')),
With:
array('PRODUCT_LIST_PRICE_BUY_NOW','0',20,array('0', '1', '2', '3')),
Replace lines 53-63:
DIR_FS_ADMIN.'includes/languages/english/extra_definitions/user_tracking_install_define.php',
DIR_FS_ADMIN.'includes/auto_loaders/config.user_tracking.php',
DIR_FS_ADMIN.'includes/classes/class.user_tracking.php',
DIR_FS_ADMIN.'includes/extra_datafiles/user_tracking_database_tables.php',
DIR_FS_ADMIN.'includes/functions/extra_functions/user_tracking.php',
DIR_FS_ADMIN.'includes/init_includes/init_user_tracking_install.php',
DIR_FS_ADMIN.'includes/languages/english/user_tracking.php',
DIR_FS_ADMIN.'includes/languages/english/user_tracking_config.php',
/*
DIR_FS_CATALOG.'includes/modules/pages/popup_image/header_php.DEFAULT.php.OLD.CBT',
DIR_FS_CATALOG.'includes/modules/pages/popup_image_additional/header_php.DEFAULT.php.OLD.CBT'*/
With:
DIR_FS_ADMIN.'includes/languages/english/extra_definitions/cb_txtb_icon_install_define.php'
These corrections are addressed in the latest update as well as some other improvements.
Zen Follower
Going on three days without issues on my production site,
Thanks,
Totally Zenned
So, this plugin has been out there for a little while now.. Anyone have suggestions, ideas, or improvements? (Would love to have someone forward a better set of pictures for the add-to, remove-from cart buttons...)
Just thought I would check the pulse of things to see what others might be dealing with.
Zen Follower
For about 4 years I have been using a modified version of the CheckBoxTextBoxIconV1.0.0 plugin on ZC V1.5.1 with half a dozen other plugins and it has worked flawlessly but after switching to ZC V1.5.5f I'm having some issues I cannot figure out.
Going on my third day of troubleshooting....
Installed ZC V1.5.5f and added EasyPopulate-4.master-ZC, one_page_checkout-2.0.0, purchase_order_basic_v1_1b, export_shipping_information_V1.3.4, ColumnGridLayout_for_155f and CheckBoxTextBoxIconV1.0.3 plugings.
Installed CheckBoxTextBoxIconV1.0.3 last and then merged the differences in the product_listings.php and shopping_cart.php files. No funtionallity problems with the these changes.
THE ISSUE:
If I enable "Check Box and Text Box for Checkout" I get the appropriate boxes on the display but WITHOUT checking the checkbox when I hit "Add Selected to Cart " it adds the quantities in the textboxes to the cart.
I have tried numerous combinations of settings but no joy. (also tried CheckBoxTextBoxIconV1.0.0)
Althought it messes up the display I even tried copying the product_listing and shopping_cart.php files from my ZC V1.5.1 working production installation but get the same results.
Bottom line is any time there is a quantity in the text box and you click "Add Selected to Cart" it gets added to the cart without the checkbox being checked.
(Although this functionality will extend to the "all, featured and special products" pages right now I'm focused on getting the main product listing fixed)
Please see attached ProductListing.jpg file for configuration settings and below that the product_listing.php script.
(Apologies for the lengthy code)
Live test site at pcsnnets.com/tp19
<?php
/**
* product_listing module
*
* @package modules
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: picaflor-azul Mon Feb 15 13:59:01 2016 -0500 New in v1.5.5 $
* With CLG By LTO July 2018 Merged CBT With this File
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
// bof Column Layout Grid
if (!defined('PRODUCT_LISTING_LAYOUT_STYLE')) define('PRODUCT_LISTING_LAYOUT_STYLE',(isset($_GET['view']) ? $_GET['view'] : 'rows'));
if (!defined('PRODUCT_LISTING_COLUMNS_PER_ROW')) define('PRODUCT_LISTING_COLUMNS_PER_ROW',3);
if (!defined('PRODUCT_LISTING_GRID_SORT')) define('PRODUCT_LISTING_GRID_SORT',0);
$product_listing_layout_style = isset($_GET['view'])? $_GET['view']: PRODUCT_LISTING_LAYOUT_STYLE;
$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';
$max_results = ($product_listing_layout_style=='columns' && PRODUCT_LISTING_COLUMNS_PER_ROW>0) ? (PRODUCT_LISTING_COLUMNS_PER_ROW * (int)(MAX_DISPLAY_PRODUCTS_LISTING/PRODUCT_LISTING_COLUMNS_PER_ROW)) : MAX_DISPLAY_PRODUCTS_LISTING;
// eof Column Layout Grid
$show_submit = zen_run_normal();
$listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id', 'page');
$zco_notifier->notify('NOTIFY_MODULE_PRODUCT_LISTING_RESULTCOUNT', $listing_split->number_of_rows);
$how_many = 0;
// Begin Row Layout Header
if ($product_listing_layout_style == 'rows' or PRODUCT_LISTING_GRID_SORT) { // For Column Layout (Grid Layout) add on module
$list_box_contents[0] = array('params' => 'class="productListing-rowheading"');
$zc_col_count_description = 0;
$lc_align = '';
for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_text = TABLE_HEADING_MODEL;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_NAME':
$lc_text = TABLE_HEADING_PRODUCTS;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_text = TABLE_HEADING_MANUFACTURER;
$lc_align = '';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_PRICE':
$lc_text = TABLE_HEADING_PRICE;
$lc_align = 'right' . (PRODUCTS_LIST_PRICE_WIDTH > 0 ? '" width="' . PRODUCTS_LIST_PRICE_WIDTH : '');
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_text = TABLE_HEADING_QUANTITY;
$lc_align = 'right';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_text = TABLE_HEADING_WEIGHT;
$lc_align = 'right';
$zc_col_count_description++;
break;
case 'PRODUCT_LIST_IMAGE':
if ($product_listing_layout_style == 'rows') { //skip if grid
$lc_text = TABLE_HEADING_IMAGE;
$lc_align = 'center';
$zc_col_count_description++;
}
break;
}
if ( ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
$lc_text = zen_create_sort_heading($_GET['sort'], $col+1, $lc_text);
}
$list_box_contents[0][$col] = array('align' => $lc_align,
'params' => 'class="productListing-heading"',
'text' => $lc_text );
}
if ($product_listing_layout_style == 'columns') { //grid sort option
$grid_sort = $list_box_contents[0];
$list_box_contents = array();
}
} // End Row Layout Header used in Column Layout (Grid Layout) add on module
/* Header Row Above */
$num_products_count = $listing_split->number_of_rows;
if ($listing_split->number_of_rows > 0) {
$rows = 0;
// Used for Column Layout (Grid Layout) add on module
$column = 0;
if ($product_listing_layout_style == 'columns') {
if ($num_products_count < PRODUCT_LISTING_COLUMNS_PER_ROW || PRODUCT_LISTING_COLUMNS_PER_ROW == 0 ) {
$col_width = floor(100/$num_products_count) - 0.5;
} else {
$col_width = floor(100/PRODUCT_LISTING_COLUMNS_PER_ROW) - 0.5;
}
}
// Used for Column Layout (Grid Layout) add on module
$listing = $db->Execute($listing_split->sql_query);
$extra_row = 0;
while (!$listing->EOF) {
if ($product_listing_layout_style == 'rows') { // Used in Column Layout (Grid Layout) Add on module
$rows++;
if ((($rows-$extra_row)/2) == floor(($rows-$extra_row)/2)) {
$list_box_contents[$rows] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[$rows] = array('params' => 'class="productListing-odd"');
}
$cur_row = sizeof($list_box_contents) - 1;
} // End of Conditional execution - only for row (regular style layout)
$product_contents = array(); // Used For Column Layout (Grid Layout) Add on module
for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
$lc_align = '';
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text = $listing->fields['products_model'];
break;
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($_GET['manufacturers_id'])) {
$lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
} else {
$lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
}
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_align = '';
$lc_text = '<a class="list-man" href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>';
break;
case 'PRODUCT_LIST_PRICE':
$lc_price = '<div class="list-price">' . zen_get_products_display_price($listing->fields['products_id']) . '</div>';
$lc_align = 'right';
$lc_text = $lc_price;
// more info in place of buy now
$lc_button = '';
if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
$lc_button = '<a class="list-more" href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? $_GET['cPath'] : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
} else {
if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
if (
// not a hide qty box product
$listing->fields['products_qty_box_status'] != 0 &&
// product type can be added to cart
zen_get_products_allow_add_to_cart($listing->fields['products_id']) != 'N'
&&
// product is not call for price
$listing->fields['product_is_call'] == 0
&&
// product is in stock or customers may add it to cart anyway
($listing->fields['products_quantity'] > 0 || SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) ) {
$how_many++;
}
// hide quantity box
if ($listing->fields['products_qty_box_status'] == 0) {
$lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>';
/* Begin mc12345678 Added for checkbox/textbox Plug-In */
} elseif (PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE) {
if ((SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '1' && ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) > 0)) || SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '2' ) {
$lc_button = PRODUCTS_QUANTITY_IN_CART_LISTING . ' ' . $_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) . '<br/>';
} else {
$lc_button = '';
}
$lc_button .= sprintf(TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART_CHECKBOX, TEXT_PRODUCT_MIN_MULTIPLE_LEFT . (zen_get_buy_now_qty($listing->fields['products_id'])) . TEXT_PRODUCT_MIN_MULTIPLE_RIGHT) . "<input type=\"checkbox\" name=\"products_id2[" . $listing->fields['products_id'] . "]\" value=\"1\" size=\"4\" /><input type=\"textbox\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"" . (zen_get_buy_now_qty($listing->fields['products_id'])) . "\" size=\"4\" />";
} elseif (PRODUCT_LISTING_CHECKBOX_ACTIVE) {
if ((SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '1' && ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) > 0)) || SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '2' ) {
$lc_button = PRODUCTS_QUANTITY_IN_CART_LISTING . ' ' . $_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) . '<br/>';
} else {
$lc_button = '';
}
$lc_button .= sprintf(TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART_CHECKBOX, TEXT_PRODUCT_MIN_MULTIPLE_LEFT . (zen_get_buy_now_qty($listing->fields['products_id'])) . TEXT_PRODUCT_MIN_MULTIPLE_RIGHT) . "<input type=\"checkbox\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"" . (zen_get_buy_now_qty($listing->fields['products_id'])) . "\" size=\"4\" />";
/* End mc12345678 Added for checkbox/textbox Plug-In */
} else {
$lc_button = '<div class="list-input"><span class="list-addtext">' . TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "</span><input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" /></div>";
}
} else {
// qty box with add to cart button
if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
$lc_button= '<div class="cart-add">' . zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form></div>';
/*Begin mc12345678 Added for checkbox/textbox Plug-In */
} elseif (PRODUCT_LIST_PRICE_BUY_NOW == '3' && $listing->fields['products_qty_box_status'] !=0 ) {
if ((SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '1' && ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) > 0)) || SHOW_PRODUCT_LISTING_QUANTITY_IN_CART == '2' ) {
$lc_button = PRODUCTS_QUANTITY_IN_CART_LISTING . ' ' . $_SESSION['cart']->in_cart_mixed($listing->fields['products_id']);
} else {
$lc_button = '';
}
if ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) <> 0){
$check_min = zen_get_products_quantity_order_min($listing->fields['products_id']);
$check_units = zen_get_products_quantity_order_units($listing->fields['products_id']);
$zen_remove_some=-1;
//Conditions: Need to remove items from the cart.
// works on Mixed ON
switch (true) {
case ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) == 0 ):
//If none in cart don't do anything.
$zen_remove_some = 0;
break;
//XX If the quantity is equal to the minimum, then need to take off the minimum.
//XX If current is less than minimum, then remove item totally.
case ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) <= $check_min):
$zen_remove_some = -1 * ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']));
break;
//If greater than the minimum, then need to take off the units, but verify that result is greater than/equal to minimum or equal to zero.
case ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) > $check_min):
// set to units or difference in units to balance cart
$new_units = $check_units - fmod_round($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']), $check_units);
$zen_remove_some = ($new_units > 0 ? -$new_units : -$check_units );
$zen_remove_some = ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) + $zen_remove_some < $check_min ? -($_SESSION['cart']->in_cart_mixed($listing->fields['products_id'])) : $zen_remove_some);
break;
default:
$zen_remove_some = -$check_units;
break;
}
if ($zen_remove_some > 0) {
$zen_remove_some = -1;
}
if ($_SESSION['cart']->in_cart_mixed($listing->fields['products_id']) == $check_min){
$lc_button.= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=remove_product&product_id=' . $listing->fields['products_id'] . '#' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="hidden" name="cart_quantity" value="0" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit('1' . ICON_IMAGE_TRASH, BUTTON_DELETE_ALT) . '</form>';
} else {
$lc_button.= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id'] . '#' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="hidden" name="cart_quantity" value="'. $zen_remove_some . '" readonly /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit('1' . ICON_IMAGE_TRASH, BUTTON_DELETE_ALT) . '</form>';
}
}
$lc_button.= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id'] . '#' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="hidden" name="cart_quantity" value="'. (zen_get_buy_now_qty($listing->fields['products_id'])) . '"/><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit('1' . ICON_IMAGE_TINYCART, BUTTON_ADD_TO_CART_ALT) . '</form>';
/* End mc12345678 Added for checkbox/textbox Plug-In */
} else {
$lc_button = '<div class="cart-add"><a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a></div>';
}
}
}
$the_button = $lc_button;
$products_link = '<a class="list-more" href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$lc_text .= '' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$lc_text .= '' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '' : '') : '');
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = '<div class="list-quantity">' . $listing->fields['products_quantity'] . '</div>';
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_align = 'right';
$lc_text = '<div class="list-weight">' . $listing->fields['products_weight'] . '</div>';
break;
case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if ($listing->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
$lc_text = '';
} else {
if (isset($_GET['manufacturers_id'])) {
$lc_text = '<div class="list-image"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a></div>';
} else {
$lc_text = '<div class="list-image"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a></div>';
[ CONTINUED]
Zen Follower
[ CONTINUED]
}
}
break;
}
$product_contents[] = $lc_text; // Used For Column Layout (Grid Layout) Option
if ($product_listing_layout_style == 'rows') {
$list_box_contents[$rows][$col] = array('align' => $lc_align,
'params' => 'class="productListing-data"',
'text' => $lc_text);
}
}
// add description and match alternating colors
//if (PRODUCT_LIST_DESCRIPTION > 0) {
// $rows++;
// if ($extra_row == 1) {
// $list_box_description = "productListing-data-description-even";
// $extra_row=0;
// } else {
// $list_box_description = "productListing-data-description-odd";
// $extra_row=1;
// }
// $list_box_contents[$rows][] = array('params' => 'class="' . $list_box_description . '" colspan="' . $zc_col_count_description . '"',
// 'text' => zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION));
//}
// Following code will be executed only if Column Layout (Grid Layout) option is chosen
if ($product_listing_layout_style == 'columns') {
$lc_text = implode('<br />', $product_contents);
$lc_text = '<a name="' . $listing->fields['products_id'] . '"></a>' . $lc_text;
$list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => $lc_text);
$column ++;
if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
$column = 0;
$rows ++;
}
}
// End of Code fragment for Column Layout (Grid Layout) option in add on module
$listing->MoveNext();
}
$error_categories = false;
} else {
$list_box_contents = array();
$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => TEXT_NO_PRODUCTS);
$error_categories = true;
}
if (($how_many > 0 and $show_submit == true and $listing_split->number_of_rows > 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == 1 or PRODUCT_LISTING_MULTIPLE_ADD_TO_CART == 3) ) {
$show_top_submit_button = true;
} else {
$show_top_submit_button = false;
}
if (($how_many > 0 and $show_submit == true and $listing_split->number_of_rows > 0) and (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART >= 2) ) {
$show_bottom_submit_button = true;
} else {
$show_bottom_submit_button = false;
}
$zco_notifier->notify('NOTIFY_PRODUCT_LISTING_END', $current_page_base, $list_box_contents, $listing_split, $show_top_submit_button, $show_bottom_submit_button, $show_submit, $how_many);
if ($how_many > 0 && PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0 and $show_submit == true and $listing_split->number_of_rows > 0) {
// bof: multiple products
echo zen_draw_form('multiple_products_cart_quantity', zen_href_link(FILENAME_DEFAULT, zen_get_all_get_params(array('action')) . 'action=multiple_products_add_product', $request_type), 'post', 'enctype="multipart/form-data"');
/*Begin mc12345678 Added for checkbox/textbox Plug-In */
if ((PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == true)) {
echo zen_draw_hidden_field('check_text_active', true);
}
/*End mc12345678 Added for checkbox/textbox Plug-In */
}
Totally Zenned
@linuxguy2,
Glad it has served well for such a long time. I had seen that there were some major operational changes in later ZC versions and had considered updating the software; however, in a way was waiting for someone to report the need.
I note that the code posted is related to the information in the listing; however, the real processing of adding the product (or not) is performed further down the code line. I'll need to revisit this code to help you out and again am glad that it had worked in the previous configuration(s). I understand the need to get it done quickly and will try to do so.
Zen Follower
Thank You for responding so quickly!
To clarify:
1:
A textbox populated with the minimum amount.
2:
The ability to edit that amount.
3:
Nothing gets submitted until the checkbox is checked and "Add Selected to Cart" is clicked.
4:
The other features may come in handy in the future.
5:
Below is a mock up (1 row) of my current design.
Thanks,
Totally Zenned
linuxguy2:
Thank You for responding so quickly!
To clarify:
1:
A textbox populated with the minimum amount.
2:
The ability to edit that amount.
3:
Nothing gets submitted until the checkbox is checked and "Add Selected to Cart" is clicked.
4:
The other features may come in handy in the future.
5:
Below is a mock up (1 row) of my current design.
Thanks,
Ok, figured it out...
Apparently, the ZC function zen_not_null now operates differently than it used to or did in my previous testing. I say this because in each of the modified template files, there is this "generic" code that is intended to create a hidden field. To correct the issue described above, change the Boolean true to a string 'true' as below.
From:
if ((PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0) && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == true)) {
echo zen_draw_hidden_field('check_text_active', true);
}
if ((PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0) && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == true)) {
echo zen_draw_hidden_field('check_text_active', 'true');
}
by changing true to 'true' (don't modify other logic around it.
Perhaps the easiest way to find the area(s) to modify would be to use the developers toolkit and search for: check_text_active
Another correction I made in editing the code was in the shopping_cart class to bypass a foreach loop if there is nothing to process in the loop changing:
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
foreach ($_POST['products_id2'] as $key2 => $val2) {
to:
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
if (!isset($_POST['products_id2'])) continue;
foreach ($_POST['products_id2'] as $key2 => $val2) {
I'll see about getting an update together for distribution. There are some minor code improvements, but the two changes made above corrected the overall issue(s) encountered.
Zen Follower
Excellent! Changing true to 'true' in the modified template files fixed the add to cart issue.
However the code you listed for the "shopping_cart classes doesn't exist in any of the code I have ever downloaded for ZC or the CBTB plugin. Yes, I always use "developers toolkit " to search.
i.e.
version "CheckBoxTextBoxIconV1.0.3" nor version "CheckBoxTextBoxIcon06V1.0.0"
Am I missing something?
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
foreach ($_POST['products_id2'] as $key2 => $val2) {
Totally Zenned
linuxguy2:
Excellent! Changing true to 'true' in the modified template files fixed the add to cart issue.
However the code you listed for the "shopping_cart classes doesn't exist in any of the code I have ever downloaded for ZC or the CBTB plugin. Yes, I always use "developers toolkit " to search.
i.e.
version "CheckBoxTextBoxIconV1.0.3" nor version "CheckBoxTextBoxIcon06V1.0.0"
Am I missing something?
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
foreach ($_POST['products_id2'] as $key2 => $val2) {
That code segment is/was there, but the if statement was a little different having $multiAddCheck at the end of the logic instead of at the beginning. After some four years of additional ZC php coding experience it seemed that the logic should be modified a little to possibly bypass that section of code "faster". A similar developers tool kit search for $multiAddCheck should identify the section referenced above.
Zen Follower
NOTE:
A substantial amount of code has been added to ZC V15.5f shopping_cart classes.
Yes, that logic is there but coded differently.
It appears the "foreach" was intended to be implemented but never was.
See comment: * @todo change while loop to a foreach
/**
* Method to handle cart Action - multiple add products
*
* @param string forward destination
* @param url parameters
* @todo change while loop to a foreach
*/
function actionMultipleAddProduct($goto, $parameters) {
global $messageStack;
$addCount = 0;
if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
// Begin mc12345678 Checkbox/TextBox
if ($_POST['check_text_active'] == true) {
$multiAddCheck = true;
} else {
$multiAddCheck = false;
}
// End mc12345678 Checkbox/TextBox
while ( list( $key, $val ) = each($_POST['products_id']) ) {
// Begin mc12345678 Checkbox/TextBox
if ((PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1') && $multiAddCheck == true){
//reset($_POST['products_id2']);
while ( list( $key2, $val2 ) = each($_POST['products_id2']) ) {
if ($key == $key2) {
if ($val > 0)
{
Totally Zenned
linuxguy2:
NOTE:
A substantial amount of code has been added to ZC V15.5f shopping_cart classes.Yes, that logic is there but coded differently.
It appears the "foreach" was intended to be implemented but never was.
See comment: * @todo change while loop to a foreach
/**
if (is_array($_POST['products_id']) && sizeof($_POST['products_id']) > 0) {
// Begin mc12345678 Checkbox/TextBox
if ($_POST['check_text_active'] == true) {
$multiAddCheck = true;
} else {
$multiAddCheck = false;
}
// End mc12345678 Checkbox/TextBox
while ( list( $key, $val ) = each($_POST['products_id']) ) {
// Begin mc12345678 Checkbox/TextBox
if ((PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1') && $multiAddCheck == true){
//reset($_POST['products_id2']);
while ( list( $key2, $val2 ) = each($_POST['products_id2']) ) {
if ($key == $key2) {
if ($val > 0)
{
Yes, I forgot that I made my portion of the code more 7.x compatible by removing the list() = each() style from the code added by this plugin. I believe 1.5.6 already has modified that area for its own loop.
I may also further modify the logic of:
(PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')
to:
!(PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE != '1' && PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE != '1' && PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE != '1' && PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE != '1')
Zen Follower
mc12345678:
Ok, figured it out...
Apparently, the ZC function zen_not_null now operates differently than it used to or did in my previous testing. I say this because in each of the modified template files, there is this "generic" code that is intended to create a hidden field. To correct the issue described above, change the Boolean true to a string 'true' as below.
From:
if ((PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0) && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == true)) {
echo zen_draw_hidden_field('check_text_active', true);
}
>
> ```
if ((PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0) && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == true)) {
echo zen_draw_hidden_field('check_text_active', 'true');
}
by changing true to 'true' (don't modify other logic around it.
Perhaps the easiest way to find the area(s) to modify would be to use the developers toolkit and search for: check_text_active
Another correction I made in editing the code was in the shopping_cart class to bypass a foreach loop if there is nothing to process in the loop changing:
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
foreach ($_POST['products_id2'] as $key2 => $val2) {
>
> to:
>
> ```
if ($multiAddCheck == true && (PRODUCT_ALL_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_FEATURED_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_NEW_CHECKBOX_TEXTBOX_ACTIVE == '1' || PRODUCT_LISTING_CHECKBOX_TEXTBOX_ACTIVE == '1')){
//reset($_POST['products_id2']);
if (!isset($_POST['products_id2'])) continue;
foreach ($_POST['products_id2'] as $key2 => $val2) {
I'll see about getting an update together for distribution. There are some minor code improvements, but the two changes made above corrected the overall issue(s) encountered.
The three files tpl_modules_products_featured_listing.php, tpl_modules_products_new_listing.php and tpl_modules_products_featured_all.php also need the 'true' fix around line 26.
Took a little head scratching but I did merge the CBT additions/changes with the latest ZC 1.5.5f shopping_cart.php and if you want it I can zip it up and email it to you.
Totally Zenned
linuxguy2:
The three files tpl_modules_products_featured_listing.php, tpl_modules_products_new_listing.php and tpl_modules_products_featured_all.php also need the 'true' fix around line 26.
Took a little head scratching but I did merge the CBT additions/changes with the latest ZC 1.5.5f shopping_cart.php and if you want it I can zip it up and email it to you.
Yeah, the other three files do/did need that. Certainly could send that over, worth comparing the end results and still might find a way to intrude on the software less...
Zen Follower
mc12345678:
Yeah, the other three files do/did need that. Certainly could send that over, worth comparing the end results and still might find a way to intrude on the software less...
Your mailbox is full. You can download the file from this link.
I'm sure you can improve on this code. :smile:
http://www.linuxguy2.com/ShoppingCart.html
Totally Zenned
linuxguy2:
Your mailbox is full. You can download the file from this link.
I'm sure you can improve on this code. :smile:
http://www.linuxguy2.com/ShoppingCart.html
Downloaded, thank you. Have a few other things I'm working on at the moment but still plan to update the plugin.
Zen Follower
Out of box test installation:
ZC 155f responsive_classic
PHP 7.1
Plugins:
export_shipping_information_V1.3.4
Unless I'm missing something in the configuration...
When ordering product it appears to me you have to go to the "More Info..." link on the products pages to access the drop down or checkboxes (or other attributes) to make your selection.
Also on the order form the product is listed once with the attributes noted below it.
So the questions are:
1:
Could the attribute selection (sizes etc...) be listed on the product page.
(In my case I want checkboxes)
2:
Could the orders screen/form have each product with attribute listed as a line item.
+++++++++++++++
On the "orders" screen instead of this:
3 x 4400407
This:
3 x 4400407S .... $15.00 ...
3 x 4400407L .... $18.00 ...
Zen Follower
PHP 7.1
ZC 1.5.6
I've tried several times but have been unable to merge the CheckBoxTextBoxIconV1.0.3 > /includes/classes/shopping_cart.php with the zen-cart-v1.5.6-12102018 > /includes/classes/shopping_cart.php without it crashing the system.
The shopping_cart.php included in the CBTB plugin does work on it's own but there is a significant amount of code missing that's in the 1.5.6 shopping_cart.php script.
That code was added for a reason and I'm concerned about failures down the road.
Totally Zenned
Will look into it, but am addressing some other software updates as well.
Tell staff why this post should be reviewed.