Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Purchase Without Account Updated & Admin Functionality


Guest

Recommended Posts

jbh,

 

You need to add the pwa check for the case case 'update_order': as well. The code you showed that is above this delete case is sending the emails on order updates. Put a pwa check there too.

Edited by safoo
Link to comment
Share on other sites

Hi, thanks for your help. However, I am a bit confused

 

All of this is underneath the 'case upddate_order'

so do you mean I add those lines directly under

case: update_order ?

 

Can I view the first 100+ lines of the page as it should be? I worry I might blow it lol

 

Seriously, I cannot thank you enough. I just am a bit confused, but I am almost there thanks to you guys.

Link to comment
Share on other sites

Joel,

 

The code in orders.php has 2 cases that we are dealing with...the first one you already addressed which is when you delete an order. However, we also want to prevent an email from showing the url on the case when you update an order. So underneath the "case 'update_order':" line, there is a bunch of code that deals with that case. Since we are only worried about the email part, you need to use the pwacheck just as you did for the "deleteconfirm" case, which is around the email functions. Make the changes and if you still have problems, show us some more code from orders.php before and after the update_order case it's mail functions.

Link to comment
Share on other sites

Joel

 

When you made the change in orders.php did you overwrite the code?

 

           $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';
        }

 

This should have been replaced with this code:

 

 

// 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';
        }

 

 

If you still have the first piece of code in there that is causing the problem.

 

Regards

 

Tim

Link to comment
Share on other sites

Hi, guys. Thanks. I must be confused. To save you poor souls time, I will post the code of my page (just from the top to the 'break' after the delete case) because I am sure I did something wrong (no errors, just the link still shows on new orders)

 

<?php

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

$orders_statuses = array();
$orders_status_array = array();
$orders_status_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int)$languages_id . "'");
while ($orders_status = tep_db_fetch_array($orders_status_query)) {
$orders_statuses[] = array('id' => $orders_status['orders_status_id'],
'text' => $orders_status['orders_status_name']);
$orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
}

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if (tep_not_null($action)) {
switch ($action) {
case 'update_order':
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
$status = tep_db_prepare_input($HTTP_POST_VARS['status']);
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

$order_updated = false;
$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$check_status = tep_db_fetch_array($check_status_query);

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

$customer_notified = '0';
if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
$notify_comments = '';
if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
}

// 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;


case 'deleteconfirm':
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

tep_remove_order($oID, $HTTP_POST_VARS['restock']);

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
break;
}
}

Edited by jbh
Link to comment
Share on other sites

That seems about right....now can you go into your database and check in the 'orders' table if the most recent values for the 'purchased_without_account' column have 0's and 1's? Let us know what you find.

Edited by safoo
Link to comment
Share on other sites

jbh...are you using paypal to test this by any chance? I was looking at my orders and it seems the ones with paypal have the link in there. Let me check out my code and i'll get back to you. If you want to maybe try using the check/money order module and see if that works correctly.

 

Elliot, the problem he is having is with 'new order' emails...I assume the order update emails works correctly?

Edited by safoo
Link to comment
Share on other sites

Actually, no. But I pasted the page one of you posted and it had paypal code (I thought I blocked it out)

 

I could be wrong.

 

I just want to confirm that the point of what I am doing is to make sure non account members are the only ones who do not receive that link in the confirmation email. The way I'm going, I have to ask this stupid question ;)

Link to comment
Share on other sites

Yeah, the concern for us is new orders. I assumed that is what this was about, that's why I got confused when hearing about the 'update_order' case.

 

I just want new emails to not show that link if they don't have an account, and to show it if they do.

 

Thanks again.

Link to comment
Share on other sites

Ok, I fixed it. Thanks to page 13 on this thread:

http://www.oscommerce.com/forums/index.php?sho...ic=40352&st=120

 

However, I did notice that this shopping cart, before this mod, when I sign up, let's say, and 'continue' it still asks me to sign up, it doesn't recognize me.

 

Does anybody know if the mods that fix this will interfere with the code in these mods for 'purchase without account'?

 

Just curious.

 

Thanks for ALL of your help

Link to comment
Share on other sites

tlelliott77,

 

Which paypal contribution are you using on your site? I am using paypal ipn 0.981 in which the new order email is sent from paypal_notify.php and not order_process.php. (I am not sure how paypal_shopping_Cart_ipn works but I assume it is the same). So for us, when a customer uses PWA and pays via paypal, they are sent a url in the email. Do you think we will be able to add some type of check in paypal_notify.php for PWA? I don't think "if (!tep_session_is_registered('noaccount')) {" will work since there really isnt any session on that page as the IPN is treated as a 'robot' as far as I understand.

 

Also, the customers number is set to the next available number instead of 0. This is not that big of an issue, but do you have any ideas on the email URL?

 

We can't check for orders.purchased_without_account since that is set in checkout_success.php when the customer returns back to the site after the IPN is received.

Link to comment
Share on other sites

I get a blank page at Order_Info_Process.php

 

try it here:

www.redinstead.com.au/login.php

 

 

Anybody have any idea why???

 

 

Jen

Hi Jen

 

I love your site/store!! It is so similiar to what I invisioned for my store and I have been searching/reading posts day and night, rarely breaking. I have not slept in 22 hours. All this time trying to locate information/directions that I could understand, to create a site like yours. I am a complete moron, oops; I mean beginner at this and I want so badly to make it happen, I was just about to give up and found your url.

Can you please tell me if you have the time, what I have to do to make all the changes you have? Are there files I need to download and instal or paste somewhere. The farthest I have gotten is changing the the Store_Name in the Welcom to box at the top of the page, oh yeah and added a few items.

Please if you could find the time and the space in your heart to help me. I would be so very grateful!! I would even send you free Bath and Body products as gifts.

I understand if you can not, and I maybe way out of line begging like this in this forum but I am desperate.

If there is anyone else out there who thinks they have to time, and know how, I am at a desperate state and due to lack of sleep I am seeing doubles.

 

Thank you for any time and consideration/direction that you can offer me.

Rgrds,

Stephanie

Link to comment
Share on other sites

Greg,

 

I'll try to download the stock osc files and post the changes and the files with the changes already applied sometime this weekend.

 

Once that I have the files up maybe you can guide us as to how to have some type of check in paypal_notify.php to see if the current order was created using the PWA checkout. The reason we want to check it is so that we don't include the url to account history in the email that is sent to new customers. I assume the ""if (!tep_session_is_registered('noaccount')) {"" check from checkout_success.php won't work because there is no session associated at the time the ipn is received.

Link to comment
Share on other sites

Hi Safoo,

 

In checkout_paypalipn.php:

 

put something like:

 

if (tep_session_is_registered('noaccount')) $paypal_custom_var = 'custom=pwa&';

 

Now amend the paypalipn_v0.981 url used to regretably redirect the customer to PayPal via the GET method whence they could easily change the price of the items being purchased, to

tep_redirect("https://www.paypal.com/cgi-bin/webscr?".$paypal_custom_var."cmd=_ext-enter&redirect_cmd=_xclick&business=".MODULE_PAYMENT_PAYPALIPN_ID."&item_name=".urlencode(STORE_NAME)."&item_number=".$insert_id."&currency_code=".$paypal_ipn_currency."&amount=".$paypal_ipn_order_amount."&shipping=".$paypal_ipn_shipping_amount."&tax=".$paypal_ipn_tax_amount."&first_name=".urlencode($order->customer['firstname'])."&last_name=".urlencode($order->customer['lastname'])."&address1=".urlencode($order->customer['street_address'])."&city=".urlencode($order->customer['city'])."&state=".urlencode($order->customer['state'])."&zip=".urlencode($order->customer['postcode'])."&email=".$order->customer['email_address']."&bn=oscommerce-osmosis-0.98m2&return=".tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')."&cancel_return=".tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')."&notify_url=".MODULE_PAYMENT_PAYPALIPN_NOTIFY_URL);

 

Now in paypal_notify.php change

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $item_number, 'SSL', false) . "\n" .

To:

((isset($_POST['custom']) && $_POST['custom'] == 'pwa' ) ? '' : EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $item_number, 'SSL', false) . "\n") .

In the above the PayPal custom var parameter passed to PayPal which PayPal then returns back to the IPN script.

 

JaBevan, there is an important update to the PPSCIPN contrib required change the sendto and billto fields types in the orders_session_info db table from tinyint(1) to int(11) otherwise as soon as you get more than 127 customers your confirmation emails will not contain the relevant billing and shipping addresses.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

yes MS2.2. It works with paypal ipn and should work with any payment module. We're trying to get new instructions up this weekend..so if you want to wait a few days it might be worth it. The new changes deal with the URL to account history being sent in emails.

Link to comment
Share on other sites

I've installed this mod and when you enter in any info i get this

 

1054 - Unknown column 'purchased_without_account' in 'field list'

 

select customers_id, purchased_without_account, customers_firstname, customers_password, customers_email_address, customers_default_address_id from customers where upper(customers_email_address) = '[email protected]' and upper(customers_firstname) = 'SHANNON' and upper(customers_lastname) = 'PAPPAG'

 

[TEP STOP]

 

I am also new to this and am not super familiar with this stuff easier i may have done something wrong i also installed version PWA_0.70 and followed the instructions

my store is www.waterlesscarwashproducts.com

 

Thanks dave

Link to comment
Share on other sites

David,

 

Did you run the SQL scripts that are mentioned in the instructions?

 

Database changes new as of v0.70

 

ALTER TABLE customers ADD purchased_without_account TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER customers_id;

ALTER TABLE customers ADD INDEX (purchased_without_account);

 

****************************************************************

Database changes new as of v0.57

 

INSERT INTO configuration_group VALUES (40, 'Accounts', 'Configuration of Account settings', 40, 1);

 

INSERT INTO configuration VALUES ('', 'Purchase Without Account', 'PWA_ON', 'true', 'Allow Customers to purchase without an account', 40, 1, '2003-04-08 13:07:44', '2003-04-08 12:10:51', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

Edited by safoo
Link to comment
Share on other sites

David,

 

Did you run the SQL scripts that are mentioned in the instructions?

 

Database changes new as of v0.70

 

ALTER TABLE customers ADD purchased_without_account TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER customers_id;

ALTER TABLE customers ADD INDEX (purchased_without_account);

 

****************************************************************

Database changes new as of v0.57

 

INSERT INTO configuration_group VALUES (40, 'Accounts', 'Configuration of Account settings', 40, 1);

 

INSERT INTO configuration VALUES ('', 'Purchase Without Account', 'PWA_ON', 'true', 'Allow Customers to purchase without an account', 40, 1, '2003-04-08 13:07:44', '2003-04-08 12:10:51', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

No I did not, I thought that was part of notes. How do i do this? sorry for the dumb questions

Link to comment
Share on other sites

On your server's backend there should be some type of link for 'manage mysql databases' or 'phpmyadmin'. In there you can just paste each of the 4 scripts and it will apply the changes to your database.

Link to comment
Share on other sites

Safoo>>Thanks again for your help. I was just wondering if you know the fix for the bug where if I put in an email address that was used for when I signed up earlier on, and it will not let me proceed without an account.

 

In other words, it seems that when you sign-up one day, if you use that email address later on, without signing-in, it will not let you continue.

 

Do you or anybody else here know why this is?

 

Thanks again. I will still search for the answer, however, I figured it's best to play it safe and ask (if that is ok)

Link to comment
Share on other sites

Joel,

 

I don't understand what you mean. If you have an email address for which you created an account, you will not be able to use PWA using the same first and last name and email address. Are you asking for the fix if someone starts a checkout using PWA but doesn't complete it and then returns to the site some time later and tries to use PWA again? If that is the case, the fix can be found on the first post on page 34 of this thread (May 6 2004, 04:43 PM).

 

However, if you complete the whole checkout process all the way to checkout_success.php, then you should be able to sign backon using PWA and the same details.

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...