Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    819
    Plugin Contributions
    0

    Default Re: upgrading this plugin

    I've just completed the main functional part of a nicely working filter. A simple nicely working filter and I've taken care of the securities of the url parameters. I'll be putting together some js to go with it and submitting it as an addon soon. Is there a way to get a copy of the files up here for beta testing??

    Thanks, John

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    I'm a bit concerned about the security of the price and manufacturer filters in this code in the index_filters area, since that code runs on page load, and not after being filtered thru the product_filter_sidebox module:
    Code:
            if(isset($_GET['jpricelohi']) && zen_not_null($_GET['jpricelohi'])){
                $loHiParts = explode('_',$_GET['jpricelohi']);
                if(isset($loHiParts[0]) && zen_not_null($loHiParts[0])){
                    $and .= " and p.products_price >= ".$loHiParts[0];
                }
                if(isset($loHiParts[1]) && zen_not_null($loHiParts[1])){
                    $and .= " and p.products_price <= ".$loHiParts[1];
                }
            }
            if(isset($cleanJpManus) && zen_not_null($cleanJpManus)){
                $manu_id_string = '';
                foreach($cleanJpManus as $manu_arr_flt){
                
                $manu_id_string .= $manu_arr_flt.',';
                }
                $manu_id_string = rtrim($manu_id_string, ',');
                $and .= " and m.manufacturers_id IN (".$manu_id_string . ")";
            }
    .

    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.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    Also, the /includes/index_filters folder does support overrides.

    So you can move your custom one into /includes/index_filters/YOURTEMPLATE/default_filter.php

    But you should document in the readme that the music_filter and record_company_filter aren't supported by your plugin. (And that's probably not a problem unless someone filtering those products is actually doing a different kind of filtering than those are already triggering.)
    .

    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.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    You'll also want to document in your readme that your plugin expects the database to contain 'products_short_desc' and 'products_special_data' fields in the products_description table. Or remove those from the queries you've altered in the plugin.
    .

    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.

  5. #5
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    819
    Plugin Contributions
    0

    Default Re: upgrading this plugin

    didn't realize I could override the default_filter.php. Awesome!

    As for the security of the price sorter, I'm tapping into the built-in ZC 'sort' so it's cleansed by application_top.php. Isn't this correct?

    I'll be removing the product_short_desc. Didn't realize that was in there.

    Thanks for the feed back!

  6. #6
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    819
    Plugin Contributions
    0

    Default Re: upgrading this plugin

    Ahhh, I see. You're talking about the price filter and not the price sorter.... any recommendations on this?

  7. #7
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    819
    Plugin Contributions
    0

    Default Re: upgrading this plugin

    So I've moved the security testing into the default filter. It seems as though I've not completely nailed the security though. Please come back with a better method of cleansing .

    Thank You.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    for price, maybe this:

    Code:
    $loHiParts = explode('_', preg_replace('/[^0-9_]/', '', $_GET['jpricelohi']));
    That removes anything that's not numeric or underscore.


    Is 'jparam_manu' supposed to be an array? If so then you'll have to loop thru all the array values and sanitize them before adding them to the query.


    Is it necessary for all of these to be $_GET? It's best to limit the use of $_GET because it clutters the URL, and then it makes things complicated for setting canonical stuff for Google to understand what are "duplicate content" pages vs unique pages.
    I know the advanced-search uses $_GET, but if this filter can be done via POST it'd be better.
    Using $_GET will cause the URL to have a bunch of ugly content like:
    Code:
    &jparam_manu[]=foo&jparam_manu[]=bar&jparam_manu=1&jparam_manu=2&jparam_manu=3&jpricelohi=5_56789
    .

    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.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    And maybe something this for manufacturers?
    Code:
            $manu_arr_flt = array();
            foreach($_GET as $key => $value){
                if(preg_match('/^jparam_manu/', $key)){
                    $manu = preg_replace('/[^0-9]/', '', $value);
                    if ($manu != '')
                    {
                        $manu_arr_flt[] = $manu;
                    }
                }
            }
            if (sizeof($manu_arr_flt)) {
                $and .= " and m.manufacturers_id IN (". implode(',', $manu_arr_flt) . ")";
            }
    (These are all for the default_filters.php file)
    Last edited by DrByte; 22 Dec 2014 at 07:33 AM. Reason: implode, not explode :)
    .

    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.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: upgrading this plugin

    When you're ready to package, I recommend removing any trailing ?> from the end of all PHP files. This prevents stray "blank lines" from getting treated as HTML when certain FTP programs mangle the line-endings in the files during transfer.
    Ref: http://www.zen-cart.com/content.php?...nd-of-the-file
    .

    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.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v151 How do I install this addon?
    By saftek in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 12 Oct 2012, 10:47 AM
  2. How do I install this addon?
    By annettes in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 15 Feb 2011, 06:18 PM
  3. Beta Testing: "Surcharge Fee" addon
    By cadforte in forum All Other Contributions/Addons
    Replies: 23
    Last Post: 25 Jan 2011, 02:20 PM
  4. I have NOOOO Idea how to get this on there
    By lilguppy in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 8 Jan 2010, 04:58 AM
  5. I have this Err & I have no idea how to fix it
    By bgurtz in forum General Questions
    Replies: 0
    Last Post: 17 Nov 2008, 03:57 AM

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