close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Order Receipt Hide link if the item category was not purchased

Thread began 8/22/2013 8:30 pm by eric284736 | Last modified 8/29/2013 3:06 pm by eric284736 | 768 views | 26 replies |

eric284736

Order Receipt Hide link if the item category was not purchased

Hi Jason,

I have a link that appears on the order EMAIL receipt that sends the customer to a page on the site if they purchased an item within a certain item category. Specifically this would be ItemCatID = 6.

How can I hide this link if they did not purchase something that was in that category?

thx
Eric

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to have a column in the cart that stores the ItemCatID.

then use a loop through the cart items, to see if that column has any items that equal 6.

If there are, set a variable to true, and use that variable in an if statement around the link, for example:

php:
<?php

$catSix 
0;
while (!
$eCart1->EOF())      {
  if(
$eCart1->DisplayInfo("ItemCatID") == "6") { $catSix "1"; }
  
$eCart1->MoveNext();
}
$eCart1->MoveFirst();
?>
<?php 
if($catSix == "1") {?><a href="http://www.mydomain.com/page.php">LINK</a><?php ?>
Sign in to reply to this post

eric284736

Hi Jason,

Does it matter where this is placed on the page?

<?php

$catSix = 0;

while (!$eCart1->EOF()) {

if($eCart1->DisplayInfo("ItemCatID") == "6") { $catSix = "1"; }

$eCart1->MoveNext();

}

$eCart4->MoveFirst();

?>

Sign in to reply to this post

Jason ByrnesWebAssist

it needs to be in the email message where you want the link to show.

NOTE:
eCart1 is the name of the cart object, you will need to change this if you use a different cart name. My code was a sample of how it could be done and is not supported.

Sign in to reply to this post

eric284736

Okay, got that working! For some reason the sessions is not getting dumped and the order numbers are staying the same per different orders.
Then when the link appears for the public download page it shows the correct info, but the download button does not work.

Confused :)

thx
Eric

Attached Files
checkout_success.zip
public-download.zip
Sign in to reply to this post

Jason ByrnesWebAssist

add the following code to the checkout success after the closing </html> tag:

php:
<?php

// Initialize the session.
// If you are using session_name("something"), don't forget it now!
@session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
    
$params session_get_cookie_params();
    @
setcookie(session_name(), ''time() - 42000,
        
$params["path"], $params["domain"],
        
$params["secure"], $params["httponly"]
    );
}

// Finally, destroy the session.
@session_destroy();
@
session_regenerate_id();
?>




in the download behavior, set the trigger to use the Submit button pressed instead of current page submit.

Sign in to reply to this post

eric284736

Okay, for the checkout success page I added the kill session code. In the database Orders table it inserted the OrderReferenceID as the same number on the previous order (62672818535e9c0a53127e3a72d74d20).

I guess the session is not getting killed somewhere.

thx
Eric

Sign in to reply to this post

Jason ByrnesWebAssist

did you load the success page at least once after adding the code?

if you just add the session destroy code to the success page, and don't load it, it wont destroy the session, it needs to load at least once after it has been added before you test an order.

Sign in to reply to this post

eric284736

Yes, I cleared the browser cache and did a test to complete an order and then moved from that success page to the login area and it had killed my login session.

I also did a another test in a different browser and the same results but nothing is showing up on the download page after the order is placed. I am getting the email order receipt with the correct link to the download page.

thx
Eric

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...