Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Purchase Without Account Updated & Admin Functionality


Guest

Recommended Posts

LOL...

 

Terry

 

P.S. Would be interested to see your solution for the login issues, if you'd be so kind as to share? :)

Edited by TerryK

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

tlelliott77,

 

If you find a solution to those do share.

 

The install instructions do mention this code for not showing 'logoff' in the header:

<?php
 if (!tep_session_is_registered('noaccount')) {
echo HEADER_TITLE_LOGOFF;
       }
?>

 

That should be a starting point...but it seems all 3 of us each accomplish 1 goal in different ways.

Edited by safoo
Link to comment
Share on other sites

The tep_session_is_registered('noaccount') if statement works well. You just need to get it in the right place for each of the items you don't want to be seen by a PWA customer.

 

in my loginbox the following if statement determines if the "MY Account" box is displayed:

if (tep_session_is_registered('customer_id') {

 

I have changed it to:

if (tep_session_is_registered('customer_id') and !tep_session_is_registered('noaccount')) {

 

So it doesn't display the account info box.

 

Similarly I did the same for my wishlist.

 

I have also changed account.php so it will redirect to the login page if the session is registered to noaccount. On line 15 it said:

if (!tep_session_is_registered('customer_id')) {

 

I changed this to:

if (!tep_session_is_registered('customer_id') or tep_session_is_registered('noaccount')) {

 

I'm using STS so change the if statements in sts_display_output.php to change whether the log off and my account links are displayed at the top right.

 

I think it's about ready for me to put this part live as well.

 

Thanks to all for help and guidance.

 

Tim

Link to comment
Share on other sites

One final (hopefully) mod:

 

This is to deal with the possible case of a person starting to purchase with no account and then leaving without completing checkout. Then coming back at a later date and deciding to create an account. I suppose this is quite unlikely but better to have it covered than not.

 

In create_account.php around line 102 change:

      if ($check_email['total'] > 0) {
       $error = true;

       $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
     }

to this:

      if ($check_email['total'] > 0) {
  //PWA delete account
  	 $get_customer_info = tep_db_query("select customers_id, customers_email_address, purchased_without_account from " . TABLE_CUSTOMERS . "
          where customers_email_address = '" . tep_db_input($email_address) . "'");
 $customer_info = tep_db_fetch_array($get_customer_info);
 $customer_id = $customer_info['customers_id'];
 $customer_email_address = $customer_info['customers_email_address'];
 $customer_pwa = $customer_info['purchased_without_account'];
 if ($customer_pwa !='1') {
   $error = true;
         $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
 } else {
   tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'"); 
   tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'"); 
   tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'"); 
   tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'"); 
   tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'"); 
   tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $customer_id . "'"); 
 }
  //End PWA delete account
     }

 

If the email address they are trying to register exists they will get the normal error if it's a normal account. If it's a PWA account the account will be deleted and the create account process will proceed as if it never existed.

 

Tim

Link to comment
Share on other sites

Thanks for that, Tim!

 

Now the only real issue I see is that, once a customer reaches the checkout_success.php page, when they click the Continue button, it redirects them to the shopping_cart.php page, which of course, is now empty. That would appear to be because of this code:

 

// if the customer is not logged on, redirect them to the shopping cart page
 if (!tep_session_is_registered('customer_id')) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

 

However, when I tried to change that to add an else statement, like this:

 

// if the customer is not logged on, redirect them to the shopping cart page
if (tep_session_is_registered('noaccount')) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL'));
 }
else {
 if (!tep_session_is_registered('customer_id')) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }
}

 

it bypassed the checkout_success.php page entirely. (The order did go through, though.)

 

Any ideas on how to make the 'continue' button from checkout_success redirect a PWA customer to the index page instead of back to their shopping cart AFTER they've had a chance to read the checkout_success.php page?

 

TIA for any help!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

TerryK,

 

I just made it so that it always redirects the customer to the index.php page. I don't see how anyone could end up at checkout_success.php unless they went through the checkout process and completed it.

 

  if (!tep_session_is_registered('customer_id')) {
   tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }

Link to comment
Share on other sites

That works! Thank you!!

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Just one more thing...

 

 

What is wierd is that the code that checks for PWA users, which is :

if (tep_session_is_registered('noaccount')) { 
tep_session_destroy(); 
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL')); 
} 
else { 
tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL')); 
}

 

Is put inside the

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update'))

statement, which does not make sense to me. Maybe move that check outside the if statement and after the customer_id check? Then you can have PWA users go to index.php and regular customers be redirected to the shopping cart. Either way, I don't think it should be much of an issue.

Link to comment
Share on other sites

Okay, that now brings arise one more issue...

 

When a customer who purchased via PWA is redirected to index.php, on my site it now shows the customer's name in the 'Welcome back' text on the page. So obviously, it has not logged them out upon completion of their purchase.

 

So now what?

 

(Geez, I hate it when everything I fix creates one more new problem...) :blink:

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Doh...

 

I figured it out. I'd uploaded my old version of checkout_success.php instead of the one with PWA mod's to it.

 

It's working now.

 

Thanks,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Is there any easy walkthrough anywhere to install this contribution? I thought I was the only dummy, but apparently quite a few people are having issues installing this. I'm trying to use code comparison software, but the process is extremely tedious.

 

Any help/advice would be awesome! Thanks!

Link to comment
Share on other sites

What problems are you having? I thought the instructions were pretty straight forward. Elliot, TerryK, and I were discussing some modifications to add some extra functionality to PWA. Let me know what problems you are having.

Link to comment
Share on other sites

Safoo -

 

Huh? There are barely any instructions at all:

 

To Install:

Copy the files as they occur in their appropriate directories, be sure to backup your originals first in case you don't like it, or more likely I missed something, better to be on the safe side.

If you have already made some modifications to any of these files use a program such as Beyond Compare to see what changes were made.

 

/catalog/checkout_process.php

/catalog/checkout_success.php

/catalog/login.php

/catalog/Order_Info.php

/catalog/Order_Info_Process.php

/catalog/Order_Info_Check.php

/catalog/includes/login_pwa.php  (has the boxes stacked, if you want side-by-side boxes rename and use the login_pwa_optional.php as explained below)

/catalog/includes/login_pwa_optional.php  (this is for side-by-side boxes, if you want them this way rename this login_pwa.php and upload it instead of the previous file)

/catalog/includes/login_acc.php

****0.70 DELETED : /catalog/includes/modules/Order_Info_Process.php

/catalog/includes/modules/Order_Info_Check.php

/catalog/includes/modules/languages/english/images/buttons/button_create_account.gif

 

That doesn't say much. These files are often changed in other contribs, so I'm having a little difficulty sifting through code comparisons to see what to include and what to skip over. Others have recommended that I skip over the contribution all together; however, I think it's a very important contribution and really want to implement it.

 

I did put it on the back burner while I'm installing other contributions but am getting ready to come back around to it. The last two contributions I've installed have had really great install files: osC-PrintOrder_with_StoreLogo_v2-MS2, and the PayPal_Shopping_Cart_IPN_v2.2. If I could get my store up and running (and actually selling) I wouldn't mind trying my hand at writing a similar install doc, but right now I'm just slammed for time trying to get things rolling here.

 

Thanks for your reply! Any comments/advice would be great!

Link to comment
Share on other sites

JABevan,

 

I guess you are correct.

 

However changes need to be added to only :

 

/catalog/checkout_process.php

/catalog/checkout_success.php

/catalog/login.php

 

since the other files are new files. Are you using 'Beyond Compare'? Thats a pretty good tool to use and I suggest you compare the files given in the contribution with stock OSC files to see the changes and then add those changes to your files. If you still have any questions, try pasting your files here and I'll try to take a look at them. I have *many* contributions installed in my store, so I also had to be careful in looking through the code when applying the changes. Just be sure to backup your files.

Link to comment
Share on other sites

JABevan

 

I think this mod seemed pretty simple to install using Beyond Compare to change the three core OSC files that need changing. The difficult part was trying to iron out all of the bugs to make sure it is pretty much foolproof.

 

I don't expect there will be a new release of this with bug fixes included and a new install file. We're all pushed for time to get our own shops running how we want them to. Hopefully the team will include this functionality in the next Milestone.

 

Hope you manage to get it working - I would definitlely advise reading through this thread and implementing the fixes safoo, Terry K and I have included.

 

If you have any problems post them here and I'm sure you'll get help.

 

If you find any additional bugs we'd all like to know about them.

 

Cheers

Tim

Link to comment
Share on other sites

Safoo / Tim -

 

Thanks for taking the time to answer, I appreciate it! PWA is probably the most important feature I have on my to-dos list right now. I'm finishing up the PayPal contrib today (hopefully) and will be starting again on PWA. I may come back with more specific questions.

 

Safoo - I develop on a Mac OS X machine and tried to find programs similar to Beyond Compare. I actually found a two really great comparison programs, but they don't integrate the changes (can't even copy and paste). Right now I'm trying Guiffy, which seems decent enough. But you're right, instead of trying to do a comparison to my existing modified files I need to compare them to the originals.

 

Thanks!

JAB*

Link to comment
Share on other sites

TerryK/Safoo>>I tried the changes made, to remove the email link for non account orders, yet it still appears in the email. Keep in mind, Safoo's post, I followed all instructions.

 

Anybody know what I am missing?

 

Thanks

Link to comment
Share on other sites

By the way, I see an error on my admin/orders.php page

"Parse error: parse error in /home/travelel/public_html/catalog2/admin/orders.php on line 82"

 

That line is:

case 'deleteconfirm':

 

Before it is

 

break;

 

That is part of the block of code I try to modify:

 

// start pwa changes   
$pwa_check_query= tep_db_query("select purchased_without_account from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");
$pwa_check= tep_db_fetch_array($pwa_check_query);
if ($pwa_check['purchased_without_account'] != '1'){

          $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
} else {
  $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
}
          tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

          $customer_notified = '1';
        }

         }

         tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "')");

         $order_updated = true;
       }

       if ($order_updated == true) {
        $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
       } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
       }

       tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
     
 break;

 

I know the problem is here, I just can't put my finger on it...

 

Thanks so much for this outstanding thread...

Link to comment
Share on other sites

Note: can't edit above post, don't know why.

 

Anyway, I fixed that error, but the link still appears in the email? What was the point of the changes to admin/orders.php and checkout_success.php?

 

What do I do?

 

Thanks

Link to comment
Share on other sites

did you make the changes to checkout_success.php? Basically, the changes in checkout_success.php set a 'purchased_without_account' flag in the orders table if the order was checked out using PWA. The changes in orders.php make it check if the pwa flag is true or not before sending the link in the email.

 

Can you show the changes you made to orders.php? You do not need to show the whole file, just show the changes and a few lines above and below.

 

Also, you ran the sql script to create the 'purchased_without_account' field in the orders table?

Edited by safoo
Link to comment
Share on other sites

"See the second post on page 33 of this thread which details the 3 changes you need to make."

 

As I stated (Or I thought I did, it was late) I made the changes you talked about.

 

Checkout_Success.php

admin/orders.php

the table change in phpmyadmin

 

NO change. I still get the email

 

I don't receive page errors. The order goes through, but oddly enough, that darn link appears in the email when the non account users order.

 

Thanks

Edited by jbh
Link to comment
Share on other sites

I made the change originally to checkout_success.php

and then one of you posted your whole file and I used that as well.

 

So that would show the code I have for that page.

 

As for admin/orders.php, I must have done something wrong.

 

I'll post the section from "

// start pwa changes " to "break;

case 'deleteconfirm':"

 

// start pwa changes 
$pwa_check_query= tep_db_query("select purchased_without_account from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");
echo $pwa_check_query;
$pwa_check= tep_db_fetch_array($pwa_check_query);
if ($pwa_check['purchased_without_account'] != '1'){

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
} else {
$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
}
tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);


# End of the email feature

$customer_notified = '1';
}
tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')");

$order_updated = true;
}

if ($order_updated == true) {
$messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
} else {
$messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
}

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
break;

 

Above that I have:

 

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';
}

 

Thanks...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...