Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround to the get the customer order view working with email addresses that include a "+" character #1391

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion design/admin/templates/shop/orderlist.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{if is_null($Orders.item.account_name)}
<s><i>{'( removed )'|i18n( 'design/admin/shop/orderlist' )}</i></s>
{else}
<a href={concat( '/shop/customerorderview/', $Orders.item.user_id, '/', $Orders.item.account_email )|ezurl}>{$Orders.item.account_name|wash}</a>
<a href={concat( '/shop/customerorderview/', $Orders.item.user_id, '?email=', $Orders.item.account_email|urlencode )|ezurl}>{$Orders.item.account_name|wash}</a>
{/if}
</td>

Expand Down
12 changes: 11 additions & 1 deletion kernel/shop/customerorderview.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@

$tpl = eZTemplate::factory();

$Email = urldecode( $Email );
// allow usage of get parameter as well which is safer for some email formats
if ( $Email )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always be true, unless $Email would be set null or false, which won't happen because of the line 10.
I sugest:

$Email = urldecode( $Email );
if ( $http->hasGetVariable( "email" ) )
{
    $Email = $http->getVariable( "email" );
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateuszbieniek, that is what I had before I followed the suggestion of @andrerom in #1199 (comment) 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now changed it back to your suggestion.

{
$Email = urldecode( $Email );
}
// workaround because it doesn't seem to be possible to get an urlencoded "+" character accross $Params
else if ( $http->hasGetVariable( "email" ) )
{
$Email = $http->getVariable( "email" );
}

$productList = eZOrder::productList( $CustomerID, $Email );
$orderList = eZOrder::orderList( $CustomerID, $Email );

Expand Down