Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2016
    Location
    Minneapolis, MN
    Posts
    17
    Plugin Contributions
    0

    help question Stripping the Admin Category Page

    I have PHP 5.6.0 and MySql 5.5.54.
    I believe we have COWOA installed on this store and the Categories Center Box Mod by Numinex

    But we have taken our main site and made clones of it for our customers as we are wholesalers and want to offer our clients a way to have an online catalog of our products.
    So while this is 151 its been HEAVILY modified to have this functionality. Unfortunately I did not do the modifications, the guy who did them didn't document, and I have 7 months experience with Web Design. (I've been working for this company for 7 months.)

    One of the functionalities my boss wants for these sites is to allow our customers to select which categories they want to show on their site. So what I want to do is strip most of the functionality of the admin categories page to just allow them to turn off/on the categories. Nothing Else. I don't need it to go to the other page and warn them that is will turn off all the products also.

    So my thought was to change this in the categories_product_listing.php module:
    PHP Code:
    <?php
          
    if ($categories->fields['categories_status'] == '1') {
            echo  
    zen_draw_form('setflag_categories'FILENAME_CATEGORIES'action=setflag&cID=' $categories>fields['categories_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : ''));?> 
            <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_green_on.gif" title="<?php echo IMAGE_ICON_STATUS_ON?>" />
            <input type="hidden" name="flag" value="0" />
            </form>
    <?php            
              
    }else {
             echo  
    zen_draw_form('setflag_categories'FILENAME_CATEGORIES'action=setflag&cID=' $categories>fields['categories_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : ''));?> 
            <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_red_on.gif" title="<?php echo IMAGE_ICON_STATUS_OFF?>" />
            <input type="hidden" name="flag" value="0" />
            </form>
          }
    Which I believe will mimic what happens when a single product is turned on/off. That is this code.
    PHP Code:
    <?php
          
    if ($products->fields['products_status'] == '1') {
            echo 
    zen_draw_form('setflag_products'FILENAME_CATEGORIES'action=setflag&pID=' $products->fields['products_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : ''));?>
            <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_green_on.gif" title="<?php echo IMAGE_ICON_STATUS_ON?>" />
            <input type="hidden" name="flag" value="0" />
            </form>
    <?php
          
    } else {
            echo 
    zen_draw_form('setflag_products'FILENAME_CATEGORIES'action=setflag&pID=' $products->fields['products_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : ''));?>
            <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_red_on.gif" title="<?php echo IMAGE_ICON_STATUS_OFF?>"/>
            <input type="hidden" name="flag" value="1" />
            </form>
    Here is the original code from categories_products_listing:
    PHP Code:
    ?php
          
    if ($categories->fields['categories_status'] == '1') {
            echo 
    '<a href="' zen_href_link(FILENAME_CATEGORIES'action=setflag_categories&flag=0&cID=' $categories->fields['categories_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : '')) . '">' zen_image(DIR_WS_IMAGES 'icon_green_on.gif'IMAGE_ICON_STATUS_ON) . '</a>';
          } else {
            echo 
    '<a href="' zen_href_link(FILENAME_CATEGORIES'action=setflag_categories&flag=1&cID=' $categories->fields['categories_id'] . '&cPath=' $cPath . (isset($_GET['page']) ? '&page=' $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' $_GET['search'] : '')) . '">' zen_image(DIR_WS_IMAGES 'icon_red_on.gif'IMAGE_ICON_STATUS_OFF) . '</a>';
          }
          if (
    zen_get_products_to_categories($categories->fields['categories_id'], true'products_active') == 'true') {
            echo 
    '&nbsp;&nbsp;' zen_image(DIR_WS_IMAGES 'icon_yellow_on.gif'IMAGE_ICON_LINKED);
          }
    ?> 
    So can y'all look it over and see if what I did wrong because right now the categories.php is only loading the legend.

    Oh yeah I have looked at my Logs and nothing has been added.
    Thank you so much for all the help! I've scoured this site many a times looking for answers and plugins.

    This is our main site:

    Wholesale Store

    This is one of our clone sites:
    Cloned Store (my test one)

    I'm sure it's something easy stupid that I missed since I've been working on this since 6:30 am
    Last edited by tmpinsnty; 9 Feb 2017 at 08:37 PM. Reason: logs

  2. #2
    Join Date
    Jul 2012
    Posts
    11,622
    Plugin Contributions
    13

    Default Re: Stripping the Admin Category Page

    Oye. So a ZC 1.5.1 site (5+ years old now) running on PHP 5.6 (was hardly a twinkle in the PHP writers eyes) to have the admin/categories.php file modified to try to disable categories on the store front without asking about the condition of the product.

    Takes more than modifying the action portion of the link. Need to look at what that action does/needs.

    Setflag as found by searching for 'setflag' (with single quote) expects the pID to be on the uri in order to change the status and as is, only the product status is set/designed to be modified.

    This can be determined by looking at the provided/revised line. Basically what it is saying is: load the categories page, assign the action to be setflag, and the cID to the category selected/clicked on and change its condition (true to false or false to true). So, when the page is loaded, the action is inspected and based on the provided action, the applicable code is executed.

    The default action for status change of the category is 'setflag_categories'. If you wish that operation to change then need to locate where the code is to "respond" when the action is set to that, or need to create a separate action command to obtain the result(s) desired which could be similar to setflag but does all of the action that you are wanting to be done when "bypassing" the current "warning". Whether that is to go ahead and disable the product, enable all of the product or leave as is...

    Shame that now for them to either enable all or disable all that they would have to select each product individually or write a sql query themselves to do so...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

 

 

Similar Threads

  1. Replies: 7
    Last Post: 5 Sep 2016, 09:00 PM
  2. v139h ez-page stripping/changing html code
    By keneso in forum General Questions
    Replies: 6
    Last Post: 13 Dec 2012, 11:54 AM
  3. Metatags stripping the inches (") character?
    By StrictlyAutoParts in forum Basic Configuration
    Replies: 0
    Last Post: 1 Aug 2008, 04:53 PM
  4. Admin redirecting and stripping out the 'www'
    By Waitrose Carpark in forum General Questions
    Replies: 6
    Last Post: 17 Jan 2007, 01:09 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