Thread: Wholesale Patch

Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    26
    Plugin Contributions
    0

    Default Wholesale Patch

    Name: Wholesale Patch
    Function: Display wholesale prices to only wholesale users.
    Configuration time: 5 min
    Difficulty: Medium

    IMPORTANT NOTICE - INSTALLATION OF THIS PATCH MAY CAUSE UNKNOWN OR UNEXPECTED ERRORS. I AM NOT RESPONSIBLE FOR ANY PROBLEMS THIS SCRIPT MAY CAUSE ON YOUR FILES. YOU ARE INSTALLING THIS AT YOUR OWN WILL AND I MAY NOT BE HELD RESPONSIBLE FOR ANYTHING.

    Earlier we had discussed making a patch that would allow you to select cutomers to get special access to prices. This patch will allow you to do that.

    INSTALLATION:

    IT IS STRONGLY RECOMMENDED THAT YOU HAVE BASIC PHP KNOWLEDGE AND/OR KNOWLEDGE AND ABILITY TO VIEW MYSQL DATA (EX. PHPMYADMIN)

    Ftp your way here: yourstorefolder/includes/templates/template_default/templates/templates/

    Find the file named: templates tpl_modules_products_quantity_discounts.php


    Keep that FTP window open, but continue on. Open up notepad or your favorite editor. Paste the following code into Notepad.

    ***************************************************************************


    Code:
    <?php
    /**
     * Module Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 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: tpl_modules_products_quantity_discounts.php 3291 2006-03-28 04:03:38Z ajeh $
    **
    * Wholesale code by Matt
    **
     *
     */
    
    ?>
    
    <?
    $ididid =  $_SESSION['customer_id'];
    $username="";
    $password="";
    $database="";
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $result = mysql_query("SELECT * FROM zen_customers
     WHERE customers_id='2'") or die(mysql_error()); 
    mysql_close();
    $row = mysql_fetch_array( $result );
    // echo $row['customers_group_pricing'];
    ?>
    <div id="productQuantityDiscounts">
    <?php
      if ($zc_hidden_discounts_on) {
    ?>
      <table border="1" cellspacing="2" cellpadding="2">
        <tr>
          <td colspan="1" align="center">
          <?php echo TEXT_HEADER_DISCOUNTS_OFF; ?>
          </td>
        </tr>
        <tr>
          <td colspan="1" align="center">
          <?php echo $zc_hidden_discounts_text; ?>
          </td>
        </tr>
      </table>
    <?php } else { 
    if ($row['customers_group_pricing'] == '1') {
    ?>
      <table border="1" cellspacing="2" cellpadding="2">
        <tr>
          <td colspan="<?php echo $columnCount+1; ?>" align="center">
    <?php
      switch ($products_discount_type) {
        case '1':
          echo TEXT_HEADER_DISCOUNT_PRICES_PERCENTAGE;
          break;
        case '2':
          echo TEXT_HEADER_DISCOUNT_PRICES_ACTUAL_PRICE;
          break;
        case '3':
          echo TEXT_HEADER_DISCOUNT_PRICES_AMOUNT_OFF;
          break;
      }
    ?>
          </td>
        </tr>
    
        <tr>
          <td align="center"><?php echo $show_qty . '<br />' . $currencies->display_price($show_price, zen_get_tax_rate($products_tax_class_id)); ?></td>
    
    <?php
      foreach($quantityDiscounts as $key=>$quantityDiscount) {
    ?>
    <td align="center"><?php echo $quantityDiscount['show_qty'] . '<br />' . $currencies->display_price($quantityDiscount['discounted_price'], zen_get_tax_rate($products_tax_class_id)); ?></td>
    <?php
        $disc_cnt++;
        if ($discount_col_cnt == $disc_cnt && !($key == sizeof($quantityDiscount))) {
          $disc_cnt=0;
    ?>
      </tr><tr>
    <?php
        }
      }
    ?>
    <?php
      if ($disc_cnt < $columnCount) {
    ?>
        <td align="center" colspan="<?php echo ($columnCount+1 - $disc_cnt)+1; ?>"> &nbsp; </td>
    <?php } ?>
        </tr>
    <?php
      if (zen_has_product_attributes($products_id_current)) {
    ?>
        <tr>
          <td colspan="<?php echo $columnCount+1; ?>" align="center">
            <?php echo TEXT_FOOTER_DISCOUNT_QUANTITIES; ?>
          </td>
        </tr>
    <?php } ?>
      </table>
    <?php }} // hide discounts ?>
    </div>

    ***************************************************************************



    Now we start the configuration:

    At the top of the file, edit these lines:

    $username=""; //username that controls your mysql account
    $password=""; //password to that username
    $database=""; //database that zen runs in


    All of that information can be found in configure.php


    SET ALL THAT ASIDE BUT DO NOT EXIT PAGES/FILES

    Open your admin section of Zen and create a new group, name it whatever you want. DO NOT SET A DISCOUNT PRICE!!!!!!!!!!

    Keep in mind the ID of the group:


    EX...


    ID Group Name % Discount
    1 Wholesale 0.00




    My ID is '1'. REMEMBER YOURS!!!


    Open the text editor with the file. Find the line:

    if ($row['customers_group_pricing'] == '1') {


    change the '1' to your number '#'. If your number was 7, then your line would look like this:

    if ($row['customers_group_pricing'] == '7') {


    Whew, if you made it this far, then you are finished. Save that file as:
    tpl_modules_products_quantity_discounts.php

    And upload it to the ftp folder you opened earlier. When it asks if you would like to overwrite the file, select yes!

    Goodluck, post any questions you may have. I know my instructions were very difficult to follow. Maybe someone can make a user-friendly version of this.

  2. #2
    Join Date
    Jun 2006
    Posts
    26
    Plugin Contributions
    0

    Default Re: Wholesale Patch

    I can't figure out how to edit posts,......so hopefully you all will see this update!!!



    REPLACE THIS LINE:
    $result = mysql_query("SELECT * FROM zen_customers
    WHERE customers_id='2'") or die(mysql_error());


    WITH THIS LINE:
    $result = mysql_query("SELECT * FROM zen_customers
    WHERE customers_id='$ididid") or die(mysql_error());

  3. #3
    Join Date
    Jun 2006
    Posts
    26
    Plugin Contributions
    0

    Default Re: Wholesale Patch

    Please Do Not Install This Patch At This Time. It Is Still In Testing, Obviously I Posted This Without Testing All Possibilities, So Please Do Not Install This Until I Finish.

  4. #4
    Join Date
    Jun 2006
    Posts
    26
    Plugin Contributions
    0

    Default Re: Wholesale Patch

    Yeah, I only have basic PHP knowledge and this script is way above my level. I don't know any of the files/file locations since I did not create zen cart, so trying to find the file to edit is much more difficult then I thought it would be. The script above only hides the quanity prices from users not in the specified group, when they goto checkout, everyone gets the quantity prices. And I am not able to fix that. Hopefully someone can finish the patch

  5. #5
    Join Date
    Aug 2006
    Posts
    14
    Plugin Contributions
    0

    Default Re: Wholesale Patch

    Has anyone done that?
    Or at least is there a way that I can offer Wholesale discounts to certain customers?

 

 

Similar Threads

  1. Need to have wholesale pricing with quantity discounts for wholesale customers only..
    By littleturtlemama in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 16 Dec 2010, 04:47 AM
  2. XSS protection patch - and - PCI Scans - patch
    By janissaire in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 28 Jan 2010, 09:32 PM
  3. Replies: 15
    Last Post: 2 Oct 2009, 11:45 AM
  4. Need to have wholesale pricing with quantity discounts for wholesale customers only..
    By littleturtlemama in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 29 Sep 2007, 10:01 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