Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Take out of stock from catalog (front-end) *inventory taking cheats* :D

    So back when I had 1.3.9 I had a bit of code in includes/templates/mytemplate/templates/tpl_product_info_display.php

    that looked like this:

    Code:
    <?php
    if($_SESSION['customer_id'] == 2) {
    ?>
    <li><a href="/admin/product.php?cPath=<?= $_GET['cPath']; ?>&product_type=1&pID=<?= $_GET['products_id']; ?>&action=new_product&search=<?= $_GET['products_id']; ?>" target="_top" accesskey="i">Edit Product##########____(Alt+i)</a></li>
    
    <li><a href="/admin/categories.php?&search=<?= $_GET['products_id']; ?>" target="_blank" accesskey="a">Search Admin##########__(Alt+a)</a></li>
    
    <li><a href="/admin/categories.php?action=setflag&pID=<?= $_GET['products_id']; ?>&cPath=<?= $_GET['cPath']; ?>&page=1" target="_blank" accesskey="o">Take Out of Stock##########(Alt+o)</a></li>
    
    <?php
    }
    ?>
    which basically gave my customer_id "2" account a few nice admin links that I could use to help w/ inventory from the front end... but now my "Take Out of Stock" link doesn't work, I'm thinking because the added security of the 1.5.x admin...

    any suggestions on getting this working? and/or modules that already do this? It's pretty handy.

  2. #2
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    created a work around

    admin/categories.php

    Code:
          case 'setgetflag':
    
          if ( isset($_GET['flag']) && ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
            if (isset($_GET['pID'])) {
              zen_set_product_status($_GET['pID'], $_GET['flag']);
            }
          }
    
          zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')));
          break;
    and change the link text to...
    Code:
    <li><a href="/admin/categories.php?action=setgetflag&flag=0&pID=<?= $_GET['products_id']; ?>&cPath=<?= $_GET['cPath']; ?>&page=1" target="_blank" accesskey="o">Take Out of Stock##########(Alt+o)</a></li>

  3. #3
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    Is the goal of "taking out of stock" to keep the product visible but make it appear to have zero quantity? Such that it shows "out-of-stock" on the front end?

    If it is not that, and instead to "hide" the product from the front end, clicking on the green/red button within the category listing of the admin performs that action already...

    As to the issue with the front end approach, yeah, security is a reason why you don't get to where you want, but it could still be merged in one way or another.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    Quote Originally Posted by mc12345678 View Post
    Is the goal of "taking out of stock" to keep the product visible but make it appear to have zero quantity? Such that it shows "out-of-stock" on the front end?

    If it is not that, and instead to "hide" the product from the front end, clicking on the green/red button within the category listing of the admin performs that action already...

    As to the issue with the front end approach, yeah, security is a reason why you don't get to where you want, but it could still be merged in one way or another.
    I suppose the goal of "taking out of stock" would be simply hide it from the catalog so that a customer can't buy it. I somewhat use my zen-cart as an inventory management system, so I try to never just change quantities w/o some accountability.

    I have a brick and mortar store so I use the visible products in the catalog "status = 1" as "in-stock". It's easiest for me/us to take inventory by changing the status, and then eventually doing something w/ any extra quantities like "buying" them w/ a shrinkage account.
    Last edited by wolfderby; 26 Jan 2017 at 06:28 AM.

  5. #5
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    so after I updated to 1.5.5e I can't seem to get these links to work w/o having to log into the admin each time it's clicked. I tried reverted to the old 1.5.5d .htaccess but that didn't seem to fix it. Not sure what changed... :/

  6. #6
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    I also upgraded from php 5.3 to php 5.4... not sure if this would have done anything to cause this. I ran into problems w/ 1.5.5e and php 5.3 so I went to the latest my hosting offers, which is php 5.4

  7. #7
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    Does anyone know if this is not working because I'm not using the zen_href_link function? If I were to use that function I'm not sure how to reference the unique admin folder name. I'm assuming defining it as a constant would not be advised.

    I noticed that there's mention of a zen_admin_href_link in a few Github links google turned up, but it doesn't appear that was ever implemented at least as of 1.5.5e, because developer's tool kit doesn't turn it up and it's not in html_output.php that I noticed.

    Also would it even be possible link to the admin given current security measures (that are over my head programming wise) to create this link? As it is, it currently works, I just have to log-in a second time. A link I had created from the admin to another admin page had this problem until I re-created the link w/ zen_href_link.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,485
    Plugin Contributions
    88

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    There were security-related changes in the ZC 1.3.9 to 1.5.0 transition that preclude the use of an admin-level script (e.g. customers.php) outside of a logged-in admin environment.

  9. #9
    Join Date
    Dec 2008
    Location
    Pittsburgh, PA
    Posts
    237
    Plugin Contributions
    1

    Default Re: Take out of stock from catalog (front-end) *inventory taking cheats* :D

    Quote Originally Posted by lat9 View Post
    There were security-related changes in the ZC 1.3.9 to 1.5.0 transition that preclude the use of an admin-level script (e.g. customers.php) outside of a logged-in admin environment.
    Any idea how I'd go about figuring out why it's requesting the second admin log-in? For example, if I've already logged in as an admin user (before the session time's out...) why would it ask for another log in? Is there a way I can get it to echo the reason for the admin log-in ?

 

 

Similar Threads

  1. v151 Product Description Not Showing On Front End / Online Catalog
    By firstcapitalfirearms in forum General Questions
    Replies: 9
    Last Post: 23 Mar 2014, 03:15 PM
  2. Front end sync according to existing stock
    By amrami in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 3 Jan 2011, 09:39 AM
  3. How to take out the "New Products For November" section from the front page?
    By AZUKI in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Nov 2007, 01:45 AM

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