Forum

Current User: Guest Login
Please consider registering

Search 
Search Forums:


 




forward slash in item name causing blank post

Add a New Topic Reply to Post
UserPost

5:59 pm
August 3, 2008


RavanH

Guest

Hi Zack,

First let me thank you for a GREAT plugin. I have tested a little on a new WP_MU install and just upgraded to the latest QuickShop version 1.3.10.

I had some testing items set up where the item name held a forward slash and some with a vertical slash. The vertical slash now results in a dropdown (nice feature! :) ) but the forward slash results in page/post content not showing at all.

I suppose that the QS content filter returns nothing instead of filtered content when it hits a “/” ? Testing some further, I find that a back slash (\) also gives problems. The content filter returns content but does not filter the quickshop tag .

Regards,

Allard

6:59 pm
August 4, 2008


admin

Admin

posts 27

Thank you Allard!


I've noted this for the next version of QuickShop. Laughing

11:11 am
August 5, 2008


RavanH

Guest

Hmmm, replacing the / with # in the regular expression patterns like so:

[code]$pattern = '#\[quickshop:#';[/code]

all along function quickshop_button_post seems to do the trick for the forward slash issue.

The backslash still breaks the function.

I wonder if regular expression is really needed at all? Most seem to be just simple string values so would str_replace not suffice?

5:55 pm
August 5, 2008


RavanH

Guest

OK, I changed the lines 424 - 461 in quickshop.php to :

[code]       $pattern = '#\[quickshop:.+:price:#';
        preg_match_all ($pattern, $content, $matches);
        
        foreach ($matches[0] as $match)
        {            
            $pattern = '[quickshop:';
            $m = str_replace ($pattern, '', $match);
            $pattern = ':price:';
            $m = str_replace ($pattern, '', $m);
            
            $pieces = explode('|',$m);
            
            //$match = preg_replace ('/\|/', '\|', $match);            
            //$match = '/\\'.$match.'/';            
            
            if (sizeof($pieces) == 1)
            {      
                $replacement = '<object><form method="post"  action=""  style="display:inline">
                <input type="submit" value="'.$addcart.'" />
                <input type="hidden" name="product" value="'.$pieces['0'].
                '” /><input type=”hidden” name=”price” value=”';
                
                $content = str_replace ($match, $replacement, $content);
            }
            else
            {
                $options = '';
                foreach ($pieces as $option)
                {
                    $options .= “<option>$option</option>”;
                }
                $replacement = '<object><form method=”post”  action=”"  style=”display:inline”>
                <select name=”product”>'.$options.'</select>
                <input type=”submit” value=”'.$addcart.'” />
                <input type=”hidden” name=”price” value=”';
                
                $content = str_replace ($match, $replacement, $content);
[/code]

and tested a bit. It all seems to work fine even for / and \, the | still does it's dropdown trick… Hope you can use this :)

5:58 pm
August 5, 2008


RavanH

Guest

Oh, and I commented out line 436:

//$match = preg_replace ('/\|/', '\|', $match);

because I have no idea what it is for… Is that bad ?

6:32 pm
August 5, 2008


RavanH

Guest

One last suggestion and then I will go away ;) : line 739 might look better like this

<td>'.$defaultSymbol.'<input type=”text” name=”quickshop_freeshipv” value=”'.$freeshipv.'” />

(replacing te hard coded $ sign with the user defined currency symbol)

9:46 pm
August 6, 2008


admin

Admin

posts 27

Thanks very much Ravan! I'll get it added in.

Add a New Topic Reply to Post


Reply to Topic: forward slash in item name causing blank post

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 11 + 10        (Required)

Topic Reply:


 

About the Zack Design forum

Currently Online:

2 Guests

Maximum Online: 13

Forums:

Groups: 3

Forums: 7

Topics: 41

Posts: 101

Members:

There are 1 members

There are 47 guests


admin has made 27 posts

Top Posters:

Administrator: admin


© Simple:Press Forum - Version 3.1.4 (Build 357)