Page 11 of 11 FirstFirst ... 91011
Results 101 to 110 of 110
  1. #101
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Map Version 1.1

    Quote Originally Posted by wsworx View Post
    The Plugin still displays etc but the quantity discounts displayed below the pricing show the lower price that is not supposed to be shown.
    If you're using MAP pricing then you're probably requiring customers to add-to-cart to see the price, so therefore you don't want the discounts box to show at all;
    therefore, you can cause it to no longer display by editing:
    /includes/templates/YOUR_TEMPLATE_DIRECTORY/templates/tpl_product_info_display.php
    You could remove the entire following section of code, or you could just make the change in red:
    Code:
    <!--bof Quantity Discounts table -->
    <?php
      if (false && $products_discount_type != 0) { ?>
    <?php
    /**
     * display the products quantity discount
     */
     require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
    <?php
      }
    ?>
    <!--eof Quantity Discounts table -->
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #102
    Join Date
    Dec 2008
    Location
    USA, North East
    Posts
    212
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    Suggestion, This is the kind of item that should automatically part of Zen as thanks to Amazon, Map pricing now pretty much enforced across the board.

  3. #103
    Join Date
    Dec 2008
    Location
    USA, North East
    Posts
    212
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    Should I be overwriting the newer code with this older code. For example, the update_product.php file has more code in the newer zen version than does the MAP file of the same name. Is overwriting safe to do?

  4. #104
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,493
    Plugin Contributions
    88

    Default Re: Map Version 1.1

    Quote Originally Posted by muah View Post
    Should I be overwriting the newer code with this older code. For example, the update_product.php file has more code in the newer zen version than does the MAP file of the same name. Is overwriting safe to do?
    Absolutely not! You'll need to perform a file-compare (using a program like WinMerge or Beyond Compare) to merge the MAP changes into that updated version.

  5. #105
    Join Date
    Dec 2008
    Location
    USA, North East
    Posts
    212
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    Quote Originally Posted by lat9 View Post
    Absolutely not! You'll need to perform a file-compare (using a program like WinMerge or Beyond Compare) to merge the MAP changes into that updated version.
    MAP VERSION: if ($_POST['image_delete'] == 1) {
    Zen version: if (isset($_POST['image_delete']) && $_POST['image_delete'] == '1') {

    a number of these types of variations, in this case I remove the zen version and replace it with the MAP version of the code?

  6. #106
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default Re: Map Version 1.1

    Quote Originally Posted by muah View Post
    MAP VERSION: if ($_POST['image_delete'] == 1) {
    Zen version: if (isset($_POST['image_delete']) && $_POST['image_delete'] == '1') {

    a number of these types of variations, in this case I remove the zen version and replace it with the MAP version of the code?
    No, you do just the opposite - assume ZC code is new and improved. And you only merge the parts that are directly related to the plugin you're installing, meaning the line that mentions MAP or the entire block of code that is about MAP (it's usually commented). In the case of update_product.php file, it's literally just 2 lines of code that need to be added. Here's the entire file for you, you can use it to understand how it's done:
    Code:
    <?php
    
    /**
     * @copyright Copyright 2003-2020 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: DrByte 2020 Jul 01 Modified in v1.5.7a $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    if (isset($_GET['pID'])) {
      $products_id = zen_db_prepare_input($_GET['pID']);
    }
    if (isset($_POST['edit']) && $_POST['edit'] == 'edit') {
      $action = 'new_product';
    } elseif ((isset($_POST['products_model']) ? $_POST['products_model'] : '') . (isset($_POST['products_url']) ? implode('', $_POST['products_url']) : '') . (isset($_POST['products_name']) ? implode('', $_POST['products_name']) : '') . (isset($_POST['products_description']) ? implode('', $_POST['products_description']) : '') != '') {
      $products_date_available = zen_db_prepare_input($_POST['products_date_available']);
      if (DATE_FORMAT_DATE_PICKER != 'yy-mm-dd' && !empty($products_date_available)) {
        $local_fmt = zen_datepicker_format_fordate(); 
        $dt = DateTime::createFromFormat($local_fmt, $products_date_available);
        $products_date_available = 'null';
        if (!empty($dt)) {
          $products_date_available = $dt->format('Y-m-d'); 
        }
      }
      $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
    
      // Data-cleaning to prevent data-type mismatch errors:
      $sql_data_array = array(
        'products_quantity' => convertToFloat($_POST['products_quantity']),
    	'map_enabled' => zen_db_prepare_input((int)$_POST['map_enabled']),
        'map_price' => convertToFloat($_POST['map_price']),
        'products_type' => (int)$_POST['product_type'],
        'products_model' => zen_db_prepare_input($_POST['products_model']),
        'products_price' => convertToFloat($_POST['products_price']),
        'products_date_available' => $products_date_available,
        'products_weight' => convertToFloat($_POST['products_weight']),
        'products_status' => (int)$_POST['products_status'],
        'products_virtual' => (int)$_POST['products_virtual'],
        'products_tax_class_id' => (int)$_POST['products_tax_class_id'],
        'manufacturers_id' => (int)$_POST['manufacturers_id'],
        'products_quantity_order_min' => convertToFloat($_POST['products_quantity_order_min']) == 0 ? 1 : convertToFloat($_POST['products_quantity_order_min']),
        'products_quantity_order_units' => convertToFloat($_POST['products_quantity_order_units']) == 0 ? 1 : convertToFloat($_POST['products_quantity_order_units']),
        'products_priced_by_attribute' => (int)$_POST['products_priced_by_attribute'],
        'product_is_free' => (int)$_POST['product_is_free'],
        'product_is_call' => (int)$_POST['product_is_call'],
        'products_quantity_mixed' => (int)$_POST['products_quantity_mixed'],
        'product_is_always_free_shipping' => (int)$_POST['product_is_always_free_shipping'],
        'products_qty_box_status' => (int)$_POST['products_qty_box_status'],
        'products_quantity_order_max' => convertToFloat($_POST['products_quantity_order_max']),
        'products_sort_order' => (int)$_POST['products_sort_order'],
        'products_discount_type' => (int)$_POST['products_discount_type'],
        'products_discount_type_from' => (int)$_POST['products_discount_type_from'],
        'products_price_sorter' => convertToFloat($_POST['products_price_sorter']),
      );
    
      $db_filename = zen_limit_image_filename($_POST['products_image'], TABLE_PRODUCTS, 'products_image');
      $sql_data_array['products_image'] = zen_db_prepare_input($db_filename);
      $new_image = 'true';
    
      // when set to none remove from database
      // is out dated for browsers use radio only
      if (isset($_POST['image_delete']) && $_POST['image_delete'] == '1') {
        $sql_data_array['products_image'] = '';
        $new_image = 'false';
      }
    
      if ($action == 'insert_product') {
        $sql_data_array['products_date_added'] = 'now()';
        $sql_data_array['master_categories_id'] = (int)$current_category_id;
    
        zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
        $products_id = zen_db_insert_id();
    
        // reset products_price_sorter for searches etc.
        zen_update_products_price_sorter($products_id);
    
        $db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id)
                      VALUES (" . (int)$products_id . ", " . (int)$current_category_id . ")");
    
        zen_record_admin_activity('New product ' . (int)$products_id . ' added via admin console.', 'info');
    
        ///////////////////////////////////////////////////////
        //// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
        ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
        ///////////////////////////////////////////////////////
      } elseif ($action == 'update_product') {
        $sql_data_array['products_last_modified'] = 'now()';
        $sql_data_array['master_categories_id'] = (!empty($_POST['master_category']) && (int)$_POST['master_category'] > 0 ? (int)$_POST['master_category'] : (int)$_POST['master_categories_id']);
    
        zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = " . (int)$products_id);
    
        zen_record_admin_activity('Updated product ' . (int)$products_id . ' via admin console.', 'info');
    
        // reset products_price_sorter for searches etc.
        zen_update_products_price_sorter((int)$products_id);
    
        ///////////////////////////////////////////////////////
        //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
    
    
        ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
        ///////////////////////////////////////////////////////
      }
    
      $languages = zen_get_languages();
      for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
        $language_id = $languages[$i]['id'];
    
        $sql_data_array = array(
          'products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
          'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
          'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
    
        if ($action == 'insert_product') {
          $insert_sql_data = array(
            'products_id' => (int)$products_id,
            'language_id' => (int)$language_id);
    
          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
    
          zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_product') {
          zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = " . (int)$products_id . " and language_id = " . (int)$language_id);
        }
      }
    
      $zco_notifier->notify('NOTIFY_MODULES_UPDATE_PRODUCT_END', array('action' => $action, 'products_id' => $products_id));
    
      zen_redirect(zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '')));
    } else {
      $messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
      zen_redirect(zen_href_link(FILENAME_CATEGORY_PRODUCT_LISTING, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '')));
    }
    
    /**
     * NOTE: THIS IS HERE FOR BACKWARD COMPATIBILITY. The function is properly declared in the functions files instead.
     * Convert value to a float -- mainly used for sanitizing and returning non-empty strings or nulls
     * @param int|float|string $input
     * @return float|int
     */
    if (!function_exists('convertToFloat')) {
    
      function convertToFloat($input = 0) {
        if ($input === null) {
          return 0;
        }
        $val = preg_replace('/[^0-9,\.\-]/', '', $input);
        // do a non-strict compare here:
        if ($val == 0) {
          return 0;
        }
    
        return (float)$val;
      }
    
    }

  7. #107
    Join Date
    Sep 2018
    Location
    UUSA
    Posts
    35
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    This is Module support zc 1.5.8?

  8. #108
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    how do i make this work,
    Code:
    if ($is_map_enabled == 0 && $products_discount_type != 0) { ?>
    because not all products are map enabled, still want to show on non mapped products

  9. #109
    Join Date
    Jun 2019
    Location
    Austin TX
    Posts
    45
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    Has anyone come up with a solution for an add-to-cart to see price for 1.5.8a? I looked through the stock settings and didn't see anything. I'm migrating/updating a site and its database to this newer version from 1.5.6b and I still have the data from the old database for which products have MAP turned on. I understand that just hiding the price on the front-end via JS will not keep bots from crawling the site and seeing/saving the price info so I know I'll have to make this change in the PHP. If there is no solution at the moment then can someone answer for me if the product_info template file is the one I would need to make modifications to in order to get the desired behavior? I'm using a non-stock template so I don't think my solution will be of value here but I can post what I learned and if I have some extra time I can go through the stock template file and post a solution for that. My only worry is data not posting correctly to the shopping cart but I'm sure I can figure that out if I come across it. All I am trying to do is have the template populate an 'add-to-cart for price' button where it normally populates with the price if the products table has a 1 in map_enabled for that individual products that it is querying. Thanks in advance!

  10. #110
    Join Date
    Jun 2019
    Location
    Austin TX
    Posts
    45
    Plugin Contributions
    0

    Default Re: Map Version 1.1

    Well I've come up with a working solution to this issue on ZC 1.5.8a. I modified the products table in the database, the tpl_product_info_display.php, the collect_info.php, and the update_product.php files in order to get 'Add to Cart to View Price' functionality working. I have never published a plugin before for Zen Cart, so it may take me a bit to figure out how that all works but is anyone interested in this before I spend the time adapting the solution for the vanilla files?

 

 
Page 11 of 11 FirstFirst ... 91011

Similar Threads

  1. v150 MAP Pricing v1.5 - display strike-through on MAP Price?
    By Johnnycopilot in forum All Other Contributions/Addons
    Replies: 20
    Last Post: 15 Feb 2013, 10:40 PM
  2. "Click for Price" for mininum advertised price
    By gems14k in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Nov 2006, 02:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR