Jump to content
Sign in to follow this  
bmcewan

Purchase Without Account Updated & Admin Functionality

Recommended Posts

Hi,

 

I have just installed the PWA contribution, however when trying to view orders placed with it through the admin, I get this error:

 

Parse error: parse error, unexpected T_CASE in /home/stev9321/public_html/sfdm/orders.php on line 76

 

This is the code it refers to: Line 76 = case 'deleteconfirm':

 

The surronding code is :

 

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

    }

  }

 

  if (($action == 'edit') && isset($HTTP_GET_VARS['oID'])) {

    $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

    $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

    $order_exists = true;

    if (!tep_db_num_rows($orders_query)) {

      $order_exists = false;

      $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');

    }

  }

 

  include(DIR_WS_CLASSES . 'order.php');

 

Anybody have any idea why this would occur.

 

Thanks

 

obviously this " case 'deleteconfirm': " does not belong there.


Treasurer MFC

Share this post


Link to post
Share on other sites

<?php
/*
 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
 
 if (!tep_session_is_registered('sendto')) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
   if ($cart->cartID != $cartID) {
     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
   }
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment($payment);

// load the selected shipping module
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping($shipping);

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

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
                         'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
                         'customers_company' => $order->customer['company'],
                         'customers_street_address' => $order->customer['street_address'],
                         'customers_suburb' => $order->customer['suburb'],
                         'customers_city' => $order->customer['city'],
                         'customers_postcode' => $order->customer['postcode'], 
                         'customers_state' => $order->customer['state'], 
                         'customers_country' => $order->customer['country']['title'], 
                         'customers_telephone' => $order->customer['telephone'], 
                         'customers_email_address' => $order->customer['email_address'],
                         'customers_address_format_id' => $order->customer['format_id'], 
                         'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
                         'delivery_company' => $order->delivery['company'],
                         'delivery_street_address' => $order->delivery['street_address'], 
                         'delivery_suburb' => $order->delivery['suburb'], 
                         'delivery_city' => $order->delivery['city'], 
                         'delivery_postcode' => $order->delivery['postcode'], 
                         'delivery_state' => $order->delivery['state'], 
                         'delivery_country' => $order->delivery['country']['title'], 
                         'delivery_address_format_id' => $order->delivery['format_id'], 
                         'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
                         'billing_company' => $order->billing['company'],
                         'billing_street_address' => $order->billing['street_address'], 
                         'billing_suburb' => $order->billing['suburb'], 
                         'billing_city' => $order->billing['city'], 
                         'billing_postcode' => $order->billing['postcode'], 
                         'billing_state' => $order->billing['state'], 
                         'billing_country' => $order->billing['country']['title'], 
                         'billing_address_format_id' => $order->billing['format_id'], 
                         'payment_method' => $order->info['payment_method'], 
                         'cc_type' => $order->info['cc_type'], 
                         'cc_owner' => $order->info['cc_owner'], 
                         'cc_number' => $order->info['cc_number'], 
                         'cc_expires' => $order->info['cc_expires'], 
                         'date_purchased' => 'now()', 
                         'orders_status' => $order->info['order_status'], 
                         'currency' => $order->info['currency'], 
                         'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $sql_data_array = array('orders_id' => $insert_id,
                           'title' => $order_totals[$i]['title'],
                           'text' => $order_totals[$i]['text'],
                           'value' => $order_totals[$i]['value'], 
                           'class' => $order_totals[$i]['code'], 
                           'sort_order' => $order_totals[$i]['sort_order']);
   tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
                         'orders_status_id' => $order->info['order_status'], 
                         'date_added' => 'now()', 
                         'customer_notified' => $customer_notification,
                         'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
   if (STOCK_LIMITED == 'true') {
     if (DOWNLOAD_ENABLED == 'true') {
       $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
                           FROM " . TABLE_PRODUCTS . " p
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                            ON p.products_id=pa.products_id
                           LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                            ON pa.products_attributes_id=pad.products_attributes_id
                           WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
       $products_attributes = $order->products[$i]['attributes'];
       if (is_array($products_attributes)) {
         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
       }
       $stock_query = tep_db_query($stock_query_raw);
     } else {
       $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
     }
     if (tep_db_num_rows($stock_query) > 0) {
       $stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
       if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
         $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
       } else {
         $stock_left = $stock_values['products_quantity'];
       }
       tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
       }
     }
   }

// Update products_ordered (for bestsellers list)
   tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

   $sql_data_array = array('orders_id' => $insert_id, 
                           'products_id' => tep_get_prid($order->products[$i]['id']), 
                           'products_model' => $order->products[$i]['model'], 
                           'products_name' => $order->products[$i]['name'], 
                           'products_price' => $order->products[$i]['price'], 
                           'final_price' => $order->products[$i]['final_price'], 
                           'products_tax' => $order->products[$i]['tax'], 
                           'products_quantity' => $order->products[$i]['qty']);
   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
   $order_products_id = tep_db_insert_id();

//------insert customer choosen option to order--------
   $attributes_exist = '0';
   $products_ordered_attributes = '';
   if (isset($order->products[$i]['attributes'])) {
     $attributes_exist = '1';
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       if (DOWNLOAD_ENABLED == 'true') {
         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
                              from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                               on pa.products_attributes_id=pad.products_attributes_id
                              where pa.products_id = '" . $order->products[$i]['id'] . "' 
                               and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
                               and pa.options_id = popt.products_options_id 
                               and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
                               and pa.options_values_id = poval.products_options_values_id 
                               and popt.language_id = '" . $languages_id . "' 
                               and poval.language_id = '" . $languages_id . "'";
         $attributes = tep_db_query($attributes_query);
       } else {
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
       }
       $attributes_values = tep_db_fetch_array($attributes);

       $sql_data_array = array('orders_id' => $insert_id, 
                               'orders_products_id' => $order_products_id, 
                               'products_options' => $attributes_values['products_options_name'],
                               'products_options_values' => $attributes_values['products_options_values_name'], 
                               'options_values_price' => $attributes_values['options_values_price'], 
                               'price_prefix' => $attributes_values['price_prefix']);
       tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

       if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
         $sql_data_array = array('orders_id' => $insert_id, 
                                 'orders_products_id' => $order_products_id, 
                                 'orders_products_filename' => $attributes_values['products_attributes_filename'], 
                                 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
                                 'download_count' => $attributes_values['products_attributes_maxcount']);
         tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
       }
       $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
     }
   }
//------insert customer choosen option eof ----
   $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
   $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
   $total_cost += $total_products_price;

   $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }

// lets start with the email confirmation
// DDB - 041103 - Add test for PWA : no display of invoice URL if PWA customer
if (!tep_session_is_registered('')) noaccount
{
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) 
 {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";
} else {
 $email_order = STORE_NAME . "\n" . 
                EMAIL_SEPARATOR . "\n" . 
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                 EMAIL_SEPARATOR . "\n" . 
                 $products_ordered . 
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                   EMAIL_SEPARATOR . "\n" .
                   tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) { 
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

 

Im getting an error after the paypal payment is processed and the user returns using "Return to Merchant" :

 

Parse error: parse error, unexpected '{' in /home/ffworld/public_html/catalog/checkout_process.php on line 225

 

Line 225 is in bold below:

 

 

 

// lets start with the email confirmation

// DDB - 041103 - Add test for PWA : no display of invoice URL if PWA customer

if (!tep_session_is_registered('')) noaccount

{

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

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

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments'])

{

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

} else {

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);


Hey its free!

Share this post


Link to post
Share on other sites

solved that issue thanks anyway

 

was down to the "noaccount" bit on the if statement, this is part of the original files and isnt needed


Hey its free!

Share this post


Link to post
Share on other sites

I added the PWA-contribution version 0.82, and everything worked fine, exactly as it should. I then added the latest add-on from March 25th "PWA straight to checkout". The installation of this add-on is extremely simple, so i don't think i can have done too much wrong here. But now when I buy a product and want to proceed to checkout, i get the error "404 - the page cannot be found". De-installing the add-on brings everything back to working perfectly again.

Is there anybody else who had this same problem? Anybody out there who can help me?

Rose

Share this post


Link to post
Share on other sites
I added the PWA-contribution version 0.82, and everything worked fine, exactly as it should. I then added the latest add-on from March 25th "PWA straight to checkout". The installation of this add-on is extremely simple, so i don't think i can have done too much wrong here. But now when I buy a product and want to proceed to checkout, i get the error "404 - the page cannot be found". De-installing the add-on brings everything back to working perfectly again.

Is there anybody else who had this same problem? Anybody out there who can help me?

Rose

What page was it looking for when you got the 404?

Share this post


Link to post
Share on other sites
What page was it looking for when you got the 404?

 

Hi Dave,

I just noticed that I get different error-messages depending on the language I use.

If I use German, the following happens:

On my homepage, I click on a product category and get redirected to the category page. There I select a product and click "buy now", which redirects me to my shopping cart. On the shopping-cart page, I click on checkout!, which should bring me to the page checkout_shipping.php. When the browser tries to open that file, he tells me "The page cannot be found" (sorry, it doesn't say 404 error; don't remember why I wrote yesterday that it did); but i checked the catalog-directory, and the file checkout_shipping.php exists.

 

In the english version of my store, the same happens as described above, but additionally I receive following error-messages in my shopping card (these messages appear in the shopping-cart page):

Warning: main(includes/languages/english/modules/shipping_estimator.php): failed to open stream: No such file or directory in /home/veilighe/public_html/store/includes/modules/shipping_estimator.php on line 15

Fatal error: main(): Failed opening required 'includes/languages/english/modules/shipping_estimator.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/veilighe/public_html/store/includes/modules/shipping_estimator.php on line 15

 

Does this sound familiar? Any idea how I could solve that problem?

 

Rose

Share this post


Link to post
Share on other sites
What's the URL?

 

I'm working on a local version and will move my files to a server probably next week. I'll get back to you then, ok? until then, i will upload a backup from yesterday and then install the whole contribution again, maybe i did make some mistakes while installing the original pwa-contribution.

thanks for your help; i'll let you know if i cannot get the problem fixed.

 

Rose

Share this post


Link to post
Share on other sites

Hi,

 

I fixed my earlier problem but now when returning customer, who previously used the PWA function, tries to use it agin it tells them that their e-mail is already assigned to an account. Should their original account not be automatically deleted when this happens.

 

I think the following code in the create account php file relates to it. Can any one see any errors in it that might be causing the accounts not to be deleted.

// DDB - 040616 - PWA
//      if ($check_email['total'] > 0) {
//        $error = true;
//        $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
//      }
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

Any help would be greatly appreciated

Thanks

Share this post


Link to post
Share on other sites
What's the URL?

 

Hi Dave,

I couldn't move to a server yet, so I haven't got an URL; should be ready by end of this week.

Now, some really strange stuff happens when I install the add-on. I re-loaded an older backup of my store and installed the pwa-contribution again. As the first time, everything works well and the system does exactly what it should do. But things get really weird when I install the "straight-to-checkout"-addon: If I am logged in as a user, I go directly to checkout. But if I am not logged in, I get the "page not found" error: I get it when trying to reach check-out, and I get it when I click on the "my account" button. All other links seem to be working ok.

Very weird, isn't it? Do you have any idea what the problem might be?

Greetings,

Rose

Share this post


Link to post
Share on other sites
Hi Dave,

I couldn't move to a server yet, so I haven't got an URL; should be ready by end of this week.

Now, some really strange stuff happens when I install the add-on. I re-loaded an older backup of my store and installed the pwa-contribution again. As the first time, everything works well and the system does exactly what it should do. But things get really weird when I install the "straight-to-checkout"-addon: If I am logged in as a user, I go directly to checkout. But if I am not logged in, I get the "page not found" error: I get it when trying to reach check-out, and I get it when I click on the "my account" button. All other links seem to be working ok.

Very weird, isn't it? Do you have any idea what the problem might be?

Greetings,

Rose

I would focus on what path it is trying to use to link to the page it can't find, and I would be checking my configure files too.

Share this post


Link to post
Share on other sites
I would focus on what path it is trying to use to link to the page it can't find, and I would be checking my configure files too.

 

The links all point to existing pages, all the files he claims he cannot find actually do exist.

The strange thing is that the add-on didn't require me to do any big changes to my files. all i had to do on installation was to substitute the file catalog/redirect.php with the file which came with the addon, plus add the line

 

require('./redirect.php');

 

to the file catalog/login.php.

 

The only thing I found strange was that the new redirect.php is nearly empty: the only code in the file is

<?php 
header ('Location: order_info.php?osCsid='.$HTTP_GET_VARS['osCsid']);
?>

 

, while the original redirect.php was a rather long file. Might it be that the guy who posted the contribution included a wrong file? Sorry if this question is really stupid, but i don't know much about coding. And besides, the installation of the add-on itself is so simple that I cannot have done anything wrong, really.

 

Rose

Share this post


Link to post
Share on other sites

Hey Rose,

 

1. Make sure to copy the original redirect.php back to the catalog folder.

 

-----------

 

2. Rename the Mods' file redirect.php to pwa_redirect.php copy the new file to your catalog folder

 

-----------

 

3. Edit catalog/login.php

 

find the line: require('includes/application_top.php');

 

Change to:

 

require('includes/application_top.php');

 

//Login pwa redirect to checkout

require('catalog/pwa_redirect.php');

 

-----------

 

4. Edit catalog/includes/filenames.php

 

Add just before the last ?>

 

//Checkout Without Account Modification Mod 

  define('FILENAME_PWA_REDIRECT', 'pwa_redirect.php');

 

Upload files and test.

 

Good luck! :D


Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Share this post


Link to post
Share on other sites
Hey Rose,

Good luck! :D

 

 

I am at PWA 0.82 and it works great. Now when I added the straight to checkout addon when I click Checkout from the shopping cart I get re-directed back to the index.php page. When I hover my mouse over the checkout link it shows checkout_shipping.php

 

 

Any ideas?

Share this post


Link to post
Share on other sites

Oh, I forgot something, sorry.

 

5. Add to catalog/includes/languages/english/ and any other language folders (you'll have to translate)

 

 

Create a empty .txt file and add this to it:

 

<?php

/*

  $Id: pwa_redirect.php,v 1 2005/04/19 01:48:08 Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2005 osCommerce

 

  Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE', 'Checkout Without Account');

define('HEADING_TITLE', 'Checkout Without Account');

?>

 

6. Rename the file to pwa_redirect.php and upload to the catalog/includes/languages/english/ and any other language folders (you'll have to translate)

 

Try it.

 

Good luck! :D

 

------------------

 

underzen,

 

Hey Rose,

Good luck!

 

I mean that, I hope you were not raggin' on me.

 

Know this, I do not have this mod installed, but I do remember in some of the earlier post for this topic, they found a way to fix your problem.

 

Good luck!


Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet!

Share this post


Link to post
Share on other sites

Oh, I forgot something, sorry.

6. Rename the file to pwa_redirect.php and upload to the catalog/includes/languages/english/ and any other language folders (you'll have to translate)

 

Try it.

 

Good luck! :D

 

------------------

 

underzen,

Know this, I do not have this mod installed, but I do remember in some of the earlier post for this topic, they found a way to fix your problem.

 

Good luck!

 

 

I use this in the very top of checkout_shipping :

 

// if there is nothing in the customers cart, redirect them to the shopping cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL');

}

 

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

 

$navigation->set_snapshot();

 

//but if we use PWA and we have stuff in the cart, go to the order info page

if ((PWA_ON == 'true') and ($cart->count_contents() > 0)) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));

// otherwise just go to the login page

} else {

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

}


Treasurer MFC

Share this post


Link to post
Share on other sites

Amanda and Greg,

thanks for your help. Amanda, I found the following code in my catalog/shipping.php:

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

 

Should I substitute that code with the code you posted?:

 

// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART), 'NONSSL');
}


// if the customer is not logged on, redirect them to the login page
if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

//but if we use PWA and we have stuff in the cart, go to the order info page
if ((PWA_ON == 'true') and ($cart->count_contents() > 0)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
// otherwise just go to the login page
} else {
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}
}

 

do I have to make this change in addition to the six steps presented by Greg?

 

Hope to hear from you,

Rose

Share this post


Link to post
Share on other sites

I have PWA installed and it appears to work fine. On checking the database I notice there appears to be one block of PWA code that does not run from checkout_success. This does not stop it working but leaves erroneous data in the database.

 

I wonder if this is just me or others have the same.

 

The PWA code in checkout_success (around line 31 for me) reads:

// Begin PWA Edit
//    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
// Added a check for a Guest checkout and cleared the session - 030411 
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')); 
}
// EOF PWA 2 of 5

 

This appears to kill the session data if the session is 'no account'. But the code that is not running is below this and only runs if the session exists (around line 64 for me):

 

// Begin PWA Edit :  Added a check for a Guest checkout and cleared the session - 030411 v0.71
if (tep_session_is_registered('noaccount')) {
 $order_update = array('purchased_without_account' => '1');
 tep_db_perform(TABLE_ORDERS, $order_update, 'update', "orders_id = '".$orders['orders_id']."'");
//  tep_db_query("insert into " . TABLE_ORDERS . " (purchased_without_account) values ('1') where orders_id = '" . (int)$orders['orders_id'] . "'");
 tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'");
 tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'");
 tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'");
 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'");
 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'");
 tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'");
 tep_session_destroy();
}
// EOF PWA 4 of 5

 

 

The result is that none of the rows are deleted and the customer effectively exists in the database. It also means that the orders row does not have the purchased_without _account field set to 1. The only way of identifying a customer as PWA is therefore using the customer table (which apparently should have been deleted!).

 

All looks a bit messy to me. I've checked the conditions and I think this is running after the session destroy above - so of course it doesn't run.

 

My question is, why is the first block there? Something doesn't seem quite as intended.

 

Any suggestions/ideas?

Edited by toasty

Share this post


Link to post
Share on other sites

Chris,

 

I think you are correct. You can probably get rid of the first block and use only the second as the second block does have tep_session_destroy.

 

On my site, it works correctly (I checked for the PWA flag in the orders table) as the first block is within the if statement:

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

 

so the first block of code is not run on the initial page load on my site.

 

Try it out and let us know what happens.

Edited by safoo

Share this post


Link to post
Share on other sites

Hey toasty,

 

You are right on with the PWA code problem there!

 

Try the following:

Checkout using PWA using

First name: Test

Last name: Customer

email: testcustomer@foobar.com

 

Make the address anything you want...

 

Complete a transaction of anything in your store. Go all the way to checkout success.

 

Quit browser.

 

Go back to your store and checkout again using PWA and the same first, last and email.

 

I'll bet when you get to the shipping screen the delivery address is blank!

 

I believe that is becuse the PWA customer data still exists in the customer DB.

 

Let me know what you find...

 

-Tom

Share this post


Link to post
Share on other sites
............I'll bet when you get to the shipping screen the delivery address is blank!

I believe that is becuse the PWA customer data still exists in the customer DB.

Let me know what you find...

-Tom

 

Tom - thanks for the response, nice to know I'm not alone.

As previously described customer data does still exist because the delete statementsd are not being executed, but the second order is fine, including delivery address. Problem is, after checkout success I can click MyAccount and see the previous order too - this is not good.

Edited by toasty

Share this post


Link to post
Share on other sites
Chris,

 

I think you are correct. You can probably get rid of the first block and use only the second as the second block does have tep_session_destroy.

 

On my site, it works correctly (I checked for the PWA flag in the orders table) as the first block is within the if statement:

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

 

so the first block of code is not run on the initial page load on my site.

 

Try it out and let us know what happens.

 

Hi Safoo,

Aha! Missed a bracket there. Mine is also in an if. Well spotted. SO how come yours is working and mine is not?

Just a thought ..I notice the IF is using GET vars are you using Register_Globals contrib? (I am).

 

Is your code standard apart from PWA in this file?

Can you email me your code so I can do a compare? Maybe I missed something simple......

 

hmmm....just done another test (I output the GETand POST vars at the top of the page.) Guess what; none of them are set so the IF is never triggered. Also, I output the session vars and noaccount var is empty, so the second set of code does not run either.

 

I guess I'll have to debug tomorrow on the assumption it is a globals issue....unless anyone has a fix handy?

 

thanks all, any more help welcome!!

Share this post


Link to post
Share on other sites

Chris,

 

For all links into the account area (my account) you need to add a condition to the link like:

 

if (!tep_session_is_registered('noaccount')) {

 

then show link

 

}

 

Whether it be in your header or on any other php file. That way only customers that are not using PWA (ie registered members) will see the my account link during chcekout.

 

Hope this helps...

 

-Tom

Share this post


Link to post
Share on other sites

Thanks Tom - I was going to deal with that after solving the data issue - you've just saved me the effort!.....but it won't work until I get my global and session vars sorted!

Edited by toasty

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×