Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jQuery/Ajax Fast checkout/Login/Create account/Shopping Cart/Bootstrap MATC 2.3.3


Recommended Posts

I must be doing something wrong. I don't see a checkout button at al when I click on fast checkout. All I see is update buttons with payment and shipping. Shouldn't these buttons automatically update anyway with jquery instead of a checkbox I am a little confused with that. I have oscommerce 2.3.4 I am trying to implement it with MVS. The things I did where the following:

 

I added this in Ajaxmanager.php

if (SELECT_VENDOR_SHIPPING == 'true') {
    include_once (DIR_WS_CLASSES . 'vendor_shipping.php');
  } else{
    include_once (DIR_WS_CLASSES . 'shipping.php');
  }

I did the following change in vendors_shipping.php

changed include to include_once

 

I did the following change in catalog/classes/order.php all changes marked with MVS

 function guest_cart() {
      global $_POST, $customer_id, $sendto, $billto, $order, $cart, $languages_id, $currency, $currencies, $shipping, $payment, $comments, $customer_default_address_id,  $firstname, $lastname, $email_address, $company, $street_address, $suburb, $city, $state, $country, $telephone, $fax, $customer_zone_id, $customer_country_id, $postcode;

      $this->content_type = $cart->get_content_type();

      if ( ($this->content_type != 'virtual') && ($sendto == false) ) {
        $sendto = $customer_default_address_id;
      }

      if (is_array($sendto) && !empty($sendto)) {
				if (!isset($sendto['country_id'])) $sendto['country_id'] = $sendto['country']['id'];
	
        $country_sendto = tep_get_countries($sendto['country_id'], true);
				$address_format_id = tep_get_address_format_id($sendto['country_id']);

				$shipping_address = array('firstname' => $sendto['firstname'],
				                          'lastname' => $sendto['lastname'],
				                          'company' => (isset($sendto['company']) ? $sendto['company'] : ''),
				                          'street_address' => $sendto['street_address'],
				                          'suburb' => (isset($sendto['suburb']) ? $sendto['suburb'] : ''),
				                          'postcode' => $sendto['postcode'],
																//	'state' => ((tep_not_null($state)) ? $state : $state),
																	'state' => ((tep_not_null($sendto['state'])) ? $sendto['state'] : ''),
				                          'city' => $sendto['city'],
				                          'zone_id' => (isset($sendto['zone_id']) ? $sendto['zone_id'] : ''),
																	'zone_name' => (isset($sendto['zone_name']) ? $sendto['zone_name'] : ''),
				                          'country_id' => $sendto['country_id'],
				                          'countries_id' => $sendto['country_id'],
				                          'countries_name' => $country_sendto['countries_name'],
				                          'countries_iso_code_2' => $country_sendto['countries_iso_code_2'],
				                          'countries_iso_code_3' => $country_sendto['countries_iso_code_3'],
				                          'address_format_id' => $address_format_id);
      } else {
	
        $shipping_address = array('firstname' => null,
                                  'lastname' => null,
                                  'company' => null,
                                  'street_address' => null,
                                  'suburb' => null,
                                  'postcode' => null,
                                  'city' => null,
                                  'zone_id' => null,
                                  'zone_name' => null,
                                  'country_id' => null,
                                  'countries_id' => null,
                                  'countries_name' => null,
                                  'countries_iso_code_2' => null,
                                  'countries_iso_code_3' => null,
                                  'address_format_id' => 0,
                                  'state' => null);
      }

      if (is_array($billto) && !empty($billto)) {
			if (!isset($billto['country_id'])) $billto['country_id'] = $billto['country']['id'];
	
				$country_billto = tep_get_countries($billto['country_id'], true);
				$address_format_id = tep_get_address_format_id($sendto['country_id']);
				
        $billing_address = array('firstname' => $billto['firstname'],
                                 'lastname' => $billto['lastname'],
                                 'company' => (isset($billto['company']) ? $billto['company'] : ''),
                                 'street_address' => $billto['street_address'],
                                 'suburb' => (isset($billto['suburb']) ? $billto['suburb'] : ''),
                                 'postcode' => $billto['postcode'],
																 'state' => ((tep_not_null($billto['state'])) ? $billto['state'] : ''),
                                 'city' => $billto['city'],
                                 'zone_id' => (isset($billto['zone_id']) ? $billto['zone_id'] : ''),
                                 'zone_name' => (isset($billto['zone_name']) ? $billto['zone_name'] : ''),
                                 'country_id' => $billto['country_id'],
                                 'countries_id' => $billto['country_id'],
                                 'countries_name' => $country_billto['countries_name'],
				                         'countries_iso_code_2' => $country_billto['countries_iso_code_2'],
				                         'countries_iso_code_3' => $country_billto['countries_iso_code_3'],
				                         'address_format_id' => $address_format_id,
       													 'state' => (isset($billto['zone_name']) ? $billto['zone_name'] : ''));
      } else {

        $billing_address = array('firstname' => null,
                                  'lastname' => null,
                                  'company' => null,
                                  'street_address' => null,
                                  'suburb' => null,
                                  'postcode' => null,
                                  'city' => null,
                                  'zone_id' => null,
                                  'zone_name' => null,
                                  'country_id' => null,
                                  'countries_id' => null,
                                  'countries_name' => null,
                                  'countries_iso_code_2' => null,
                                  'countries_iso_code_3' => null,
                                  'address_format_id' => 0,
                                  'state' => null);
      }

      if ($this->content_type == 'virtual') {
        $tax_address = array('entry_country_id' => $billing_address['countries_id'],
                             'entry_zone_id' => $billing_address['zone_id']);
      } else {
        $tax_address = array('entry_country_id' => $shipping_address['countries_id'],
                             'entry_zone_id' => $shipping_address['zone_id']);
      }

      $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
                          'currency' => $currency,
                          'currency_value' => $currencies->currencies[$currency]['value'],
                          'payment_method' => $payment,
                          'cc_type' => '',
                          'cc_owner' => '',
                          'cc_number' => '',
                          'cc_expires' => '',
                          'shipping_method' => (is_array($shipping) ? $shipping['title'] : $shipping),
                          'shipping_cost' => (is_array($shipping) ? $shipping['cost'] : ''),
//Ajax            'shipping_method' => $shipping['title'],
//Ajax            'shipping_cost' => $shipping['cost'],
                          'subtotal' => 0,
//MVS Start
                          'shipping_tax' => (is_array($shipping) ? $shipping['shipping_tax_total'] : $shipping_tax_total), //not sure if correct
                          'tax' => (is_array($shipping) ? $shipping['shipping_tax_total'] : ''), //not sure if correct
//MVS End
                          'tax_groups' => array(),
                          'comments' => (tep_session_is_registered('comments') && !empty($comments) ? $comments : ''));

      if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
        if (isset($GLOBALS[$payment]->public_title)) {
          $this->info['payment_method'] = $GLOBALS[$payment]->public_title;
        } else {
          $this->info['payment_method'] = $GLOBALS[$payment]->title;
        }

        if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {
          $this->info['order_status'] = $GLOBALS[$payment]->order_status;
        }
      }

			$address_format_id = tep_get_address_format_id($customer_country_id);
			$country = tep_get_countries($customer_country_id, true);

      $this->customer = array('firstname' => $customer_address['customers_firstname'],
                              'lastname' => $customer_address['customers_lastname'],
                              'company' => $customer_address['entry_company'],
                              'street_address' => $customer_address['entry_street_address'],
                              'suburb' => $customer_address['entry_suburb'],
                              'city' => $customer_address['entry_city'],
                              'postcode' => $customer_address['entry_postcode'],
                              'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
                              'zone_id' => $customer_address['entry_zone_id'],
                              'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),
                              'format_id' => $customer_address['address_format_id'],
                              'telephone' => $customer_address['customers_telephone'],
                              'email_address' => $customer_address['customers_email_address']);

      $this->delivery = array('firstname' => $shipping_address['entry_firstname'],
                              'lastname' => $shipping_address['entry_lastname'],
                              'company' => $shipping_address['entry_company'],
                              'street_address' => $shipping_address['entry_street_address'],
                              'suburb' => $shipping_address['entry_suburb'],
                              'city' => $shipping_address['entry_city'],
                              'postcode' => $shipping_address['entry_postcode'],
                              'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
                              'zone_id' => $shipping_address['entry_zone_id'],
                              'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),
                              'country_id' => $shipping_address['entry_country_id'],
                              'format_id' => $shipping_address['address_format_id']);

      $this->billing = array('firstname' => $billing_address['entry_firstname'],
                             'lastname' => $billing_address['entry_lastname'],
                             'company' => $billing_address['entry_company'],
                             'street_address' => $billing_address['entry_street_address'],
                             'suburb' => $billing_address['entry_suburb'],
                             'city' => $billing_address['entry_city'],
                             'postcode' => $billing_address['entry_postcode'],
                             'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
                             'zone_id' => $billing_address['entry_zone_id'],
                             'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),
                             'country_id' => $billing_address['entry_country_id'],
                             'format_id' => $billing_address['address_format_id']);

//MVS start
      $orders_shipping_id = '';
      $check_new_vendor_data_query = tep_db_query("select orders_shipping_id, orders_id, vendors_id, vendors_name, shipping_module, shipping_method, shipping_cost from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int)$order_id . "'");
      while ($checked_data = tep_db_fetch_array($check_new_vendor_data_query)) {
        $this->orders_shipping_id = $checked_data['orders_shipping_id'];
      }
//MVS End

      $index = 0;
      $products = $cart->get_products();
      for ($i=0, $n=sizeof($products); $i<$n; $i++) {
        $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                        'name' => $products[$i]['name'],
                                        'model' => $products[$i]['model'],
                                        'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                        'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                        'price' => $products[$i]['price'],
                                        'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
//MVS start
                                        'vendors_id' => $products[$i]['vendors_id'],
                                        'vendors_name' => $products[$i]['vendors_name'],
//MVS end
                                        'weight' => $products[$i]['weight'],
                                        'id' => $products[$i]['id']);

        if ($products[$i]['attributes']) {
          $subindex = 0;
          reset($products[$i]['attributes']);
          while (list($option, $value) = each($products[$i]['attributes'])) {
            $attributes_query = 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 = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
            $attributes = tep_db_fetch_array($attributes_query);

            $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
                                                                     'value' => $attributes['products_options_values_name'],
                                                                     'option_id' => $option,
                                                                     'value_id' => $value,
                                                                     'prefix' => $attributes['price_prefix'],
                                                                     'price' => $attributes['options_values_price']);

            $subindex++;
          }
        }

        $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
        $this->info['subtotal'] += $shown_price;

        $products_tax = $this->products[$index]['tax'];
        $products_tax_description = $this->products[$index]['tax_description'];
        if (DISPLAY_PRICE_WITH_TAX == 'true') {
          $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
          if (isset($this->info['tax_groups']["$products_tax_description"])) {
            $this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
          } else {
            $this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
          }
        } else {
          $this->info['tax'] += ($products_tax / 100) * $shown_price;
          if (isset($this->info['tax_groups']["$products_tax_description"])) {
            $this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
          } else {
//MVS -- add shipping tax
            $this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price + $shipping['shipping_tax_total'];
          }
        }

        $index++;
      }

     if (DISPLAY_PRICE_WITH_TAX == 'true') {
        $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
      } else {
        $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
      }
    }
  }
?>

I don't know why it isn't working. The one changes I wasn't sure about are maeked //not sure about. Hopefully someone can help me as I am sure more people would love this for MVS

Link to comment
Share on other sites

 

that was a type I meant added this to ajaxmanager.php like this:

if (SELECT_VENDOR_SHIPPING == 'true') {
    require_once (DIR_WS_CLASSES . 'vendor_shipping.php');
  } else{
    require_once (DIR_WS_CLASSES . 'shipping.php');
  }

 

You need to modify more code in order to get the MVS Add-On to work with this one.

 

 

For starters, you need to change this function in ./includes/functions/general.php

  function tep_count_shipping_modules() {
    return tep_count_modules(MODULE_SHIPPING_INSTALLED);
  }

To this:

  function tep_count_shipping_modules() {
    // MVS Start
    if (SELECT_VENDOR_SHIPPING == 'true') {
      return tep_count_modules(MODULE_VENDOR_SHIPPING_INSTALLED_1);
    } else {
      return tep_count_modules(MODULE_SHIPPING_INSTALLED);
    }
    // MVS End
  }

In ./ajax/classes/ajaxManagerTest.class.php, change this:

		<?php
		if (tep_count_shipping_modules() > 0) {
			?>
			<div class="ui-widget infoBoxContainer">

				<div class="ui-widget-header infoBoxHeading ui-corner-top"><strong><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></strong></div>

				<div class="ui-widget-content infoBoxContents ui-corner-bottom" style="float:right;">
					<div class="selectChoices">
						<?php

To this

		<?php
		if (tep_count_shipping_modules() > 0) {
			?>
			<div class="ui-widget infoBoxContainer">

				<div class="ui-widget-header infoBoxHeading ui-corner-top"><strong><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></strong></div>

				<div class="ui-widget-content infoBoxContents ui-corner-bottom" style="float:right;">
					<div class="selectChoices">
						<?php
					// MVS Start
					if (SELECT_VENDOR_SHIPPING == 'true') {
						require(DIR_WS_MODULES . 'vendor_shipping.php');
					} else {
					// MVS End

Change this:

										<span><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="shipping_'.$radio_buttons.'"');?></span>

To This:

										<span><?php echo tep_draw_radio_field('shipping_'.$radio_buttons, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="shipping_'.$radio_buttons.'"');?></span>

Change this:

						<?php
					}
				}

To This:

						<?php
					}
				}
			// MVS Start
			}
			// MVS End

Change this:

    if (!ajaxSessionIsRegistered('shipping')) ajaxSessionRegister('shipping',$shipping);

    if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {

      list($module, $method) = explode('_', $shipping);

      if (is_object($GLOBALS[$module]) || ($shipping == 'free_free') ) {
        if ($shipping == 'free_free') {
          $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
          $quote[0]['methods'][0]['cost'] = '0';
        } else {
          $quote = $shipping_modules->quote($method, $module);
        }
        if (isset($quote[0]['error']) || isset($quote['error'])) {
          ajaxSessionUnregister('shipping');
          $error = true;
        } else {
          if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
            $shipping = array('id' => $shipping,
            'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
            'cost' => $quote[0]['methods'][0]['cost']);
          }
        }
      } else {
        ajaxSessionUnregister('shipping');
        $error = true;
      }
    } else {
      $shipping = false;
      $error = true;
    }

    $this->showShippingInfo($shipping);
    $this->showCommentInfo();

To This:

		if (!ajaxSessionIsRegistered('shipping')) ajaxSessionRegister('shipping',$shipping);

		// MVS Start
		if (SELECT_VENDOR_SHIPPING == 'true') {
			$total_shipping_cost = 0;
			$shipping_title = MULTIPLE_SHIP_METHODS_TITLE;
			$vendor_shipping = $cart->vendor_shipping;
			$shipping = array();

			foreach ($vendor_shipping as $vendor_id => $vendor_data) {
				$products_shipped = $_POST['products_' . $vendor_id];
				$products_array = explode ("_", $products_shipped);

				$this->getAndPrepare('shipping_' . $vendor_id, $get, $shipping);

				$shipping_modules = new shipping($shipping);

				$shipping_data = $_GET['shipping_' . $vendor_id];
				$shipping_array = explode ("_", $shipping_data);
				$module = $shipping_array[0];
				$method = $shipping_array[1];
				$ship_tax = $shipping_array[2];

				if ( is_object($$module) || ($module == 'free') ) {
					if ($module == 'free') {
						$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
						$quote[0]['methods'][0]['cost'] = '0';
					} else {
						$total_weight = $vendor_shipping[$vendor_id]['weight'];
						$shipping_weight = $total_weight;
						$cost = $vendor_shipping[$vendor_id]['cost'];
						$total_count = $vendor_shipping[$vendor_id]['qty'];
						$quote = $shipping_modules->quote($method, $module, $vendor_id);

					}
					if (isset($quote['error'])) {
						tep_session_unregister('shipping');
					} else {
						if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
							$output[$vendor_id] = array('id' => $module . '_' . $method,
								'title' => $quote[0]['methods'][0]['title'],
								'ship_tax' => $ship_tax,
								'products' => $products_array,
								'cost' => $quote[0]['methods'][0]['cost']
								);
							$total_ship_tax += $ship_tax;
							$total_shipping_cost += $quote[0]['methods'][0]['cost'];
              }//if isset
            }//if isset
          }//if is_object
        }//foreach
        if ($free_shipping == true) {
        	$shipping_title = $quote[0]['module'];
        } elseif (count($output) <2) {
        	$shipping_title = $quote[0]['methods'][0]['title'];
        }
//MVS
        $shipping = array('id' => $SESSION['shipping'],
        	'title' => $shipping_title,
        	'cost' => $total_shipping_cost,
        	'shipping_tax_total' => $total_ship_tax,
        	'vendor' => $output
        	);

        //tep_redirect (tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
      } else {
// MVS End

      	if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {

      		list($module, $method) = explode('_', $shipping);

      		if (is_object($GLOBALS[$module]) || ($shipping == 'free_free') ) {
      			if ($shipping == 'free_free') {
      				$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
      				$quote[0]['methods'][0]['cost'] = '0';
      			} else {
      				$quote = $shipping_modules->quote($method, $module);
      			}
      			if (isset($quote[0]['error']) || isset($quote['error'])) {
      				ajaxSessionUnregister('shipping');
      				$error = true;
      			} else {
      				if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
      					$shipping = array('id' => $shipping,
      						'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
      						'cost' => $quote[0]['methods'][0]['cost']);
      				}
      			}
      		} else {
      			ajaxSessionUnregister('shipping');
      			$error = true;
      		}
      	} else {
      		$shipping = false;
      		$error = true;
      	}

      }

		$this->showShippingInfo($shipping);
		$this->showCommentInfo();

In ./ajax/javascript/ajaxManager.js, change this

		var shipping = getValue('shipping');
	}
	ajaxSendRequest('ajaxAction=PerformShippingSelection&shipping='+shipping,ajaxUpdateContentMulti,true,'shipping_area');

	return false;

To this:

		//var shipping = getValue('shipping');
		var shipping = $( ".selectChoices" ).find( "input[type=radio]:checked" ).val();
	}
	ajaxSendRequest('ajaxAction=PerformShippingSelection&' + $( ".selectChoices" ).find( "input[type=radio]:checked" ).attr( "name" ) + '='+shipping,ajaxUpdateContentMulti,true,'shipping_area');
	return false;

This is however not enough to get it working. You need to modify the code in ajaxMangerTest.class.php so that the shipping module gets selected and registered.

You'll find the code you need to modify in this function:

function _PerformShippingSelection($get, &$error)

Good luck! ;)

Edited by Dr. Rolex
Link to comment
Share on other sites

quick question on the instructions tell me to look for this code in the header section:

 

echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) .
tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) .

 

I can't find it. I am using the 2.3.4 bootstrap version

Link to comment
Share on other sites

quick question on the instructions tell me to look for this code in the header section:

 

echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) .

tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) .

 

I can't find it. I am using the 2.3.4 bootstrap version

 

If you post you entire header.php here I can help you find it.

Link to comment
Share on other sites

  • 2 months later...

Hello everyone.

 

Does anybody know where can I download the Full version of this Add-on for version 2.3.x ?

 

I have downloaded the v.2.2 and add the ajaxManagerTest.class.php. However I am having several issues. I spent a lot of time on trying to fix these  - without any luck.

 

Thanks in advance.

Link to comment
Share on other sites

I noticed that on ajax_checkout.php when I try to add a new address, which has the "#" hash sign in any field, the address is not recorded and the form crashes the page layout.

However when, I do the add address via checkout_shipping.php it works as usual - without any problem. 

 

I can't find where is the issue. It would be better either allow the hash sign or at least to return an error message which would indicate that we don't "like" the hash sign.

 

I would much appreciate any help. 

 

Thanks!

Link to comment
Share on other sites

Need help PLEASE!

 

I've been working on Fast Checkout  for days now and I can't pass through couple of issues and I'm not sure where it's coming from.

 

This is a fresh install on v.2.3.3.4.

 

On ajax_checkout.php page after logging in or after creating a new account, I try to add a new Shipping or Billing address. And when I use a hash sign (#) in the address field (i.e. 123 Main St #101) then ajax doesn't add the address to TABLE_ADDRESS_BOOK and the products and totals ($ajaxManager->showProducts(''); and $ajaxManager->showTotals('') ) are being added into 'shipping_area' (<div id="shipping_area">) creating duplicate products and totals.  

 

I am going crazy and would much appreciate any help.

 

Thanks!

Edited by hiorti
Link to comment
Share on other sites

  • 2 weeks later...

Need help PLEASE!

 

I've been working on Fast Checkout  for days now and I can't pass through couple of issues and I'm not sure where it's coming from.

 

This is a fresh install on v.2.3.3.4.

 

On ajax_checkout.php page after logging in or after creating a new account, I try to add a new Shipping or Billing address. And when I use a hash sign (#) in the address field (i.e. 123 Main St #101) then ajax doesn't add the address to TABLE_ADDRESS_BOOK and the products and totals ($ajaxManager->showProducts(''); and $ajaxManager->showTotals('') ) are being added into 'shipping_area' (<div id="shipping_area">) creating duplicate products and totals.  

 

I am going crazy and would much appreciate any help.

 

Thanks!

 

Hello Ed,

 

To fix this problem the code should be rewritten to POST the request with the data properly encoded instead of sending the information unencoded with GET.

 

I will take a look at this when I have some more time, this Add-On is in need of a update anyway..

 

To solve your immediate problem (posting # characters in the address fields), you can do this modification to ajaxManager.js

 

Find this code

function ajaxSendRequest(requestString,functionName, refresh, target, async, method) {

Replace With

function ajaxSendRequest(requestString, functionName, refresh, target, async, method) {

  requestString = requestString.replace("#", escape("#"));

Hopefully this doesn't cause any unexpected new errors. Be sure to test it before you use it on a live shop.

Link to comment
Share on other sites

Okay, this is a quick fix to escape special characters when changing address or creating a new account.

 

 

Find this

			+'&email_address='+email_address
			+'&gender='+gender
			+'&firstname='+firstname
			+'&lastname='+lastname
			+'&dob='+dob
			+'&company='+company
			+'&street_address='+street_address
			+'&suburb='+suburb
			+'&postcode='+postcode
			+'&city='+city
			+'&state='+state
			+'&country='+country
			+'&telephone='+telephone
			+'&fax='+fax
			+'&newsletter='+newsletter
			+'&password='+password
			+'&confirmation='+confirmation
			+'&guest='+guest

Replace with

			+'&email_address='+ escape( email_address )
			+'&gender='+ escape( gender )
			+'&firstname='+ escape( firstname )
			+'&lastname='+ escape( lastname )
			+'&dob='+ escape( dob )
			+'&company='+ escape( company )
			+'&street_address='+ escape( street_address )
			+'&suburb='+ escape( suburb )
			+'&postcode='+ escape( postcode )
			+'&city='+ escape( city )
			+'&state='+ escape( state )
			+'&country='+ escape( country )
			+'&telephone='+ escape( telephone )
			+'&fax='+ escape( fax )
			+'&newsletter='+ escape( newsletter )
			+'&password='+ escape( password )
			+'&confirmation='+ escape( confirmation )
			+'&guest='+ escape( guest )

Find This

				+'&gender='+gender
				+'&firstname='+firstname
				+'&lastname='+lastname
				+'&company='+company
				+'&street_address='+street_address
				+'&suburb='+suburb
				+'&postcode='+postcode
				+'&city='+city
				+'&state='+state
				+'&country='+country

Replace With

				+'&gender='+ escape( gender )
				+'&firstname='+ escape( firstname )
				+'&lastname='+ escape( lastname )
				+'&company='+ escape( company )
				+'&street_address='+ escape( street_address )
				+'&suburb='+ escape( suburb )
				+'&postcode='+ escape( postcode )
				+'&city='+ escape( city )
				+'&state='+ escape( state )
				+'&country='+ escape( country )

Find this

				+'&gender='+gender
				+'&firstname='+firstname
				+'&lastname='+lastname
				+'&company='+company
				+'&street_address='+street_address
				+'&suburb='+suburb
				+'&postcode='+postcode
				+'&city='+city
				+'&state='+state
				+'&country='+country

Replace with

				+'&gender='+ escape( gender )
				+'&firstname='+ escape( firstname )
				+'&lastname='+ escape( lastname )
				+'&company='+ escape( company )
				+'&street_address='+ escape( street_address )
				+'&suburb='+ escape( suburb )
				+'&postcode='+ escape( postcode )
				+'&city='+ escape( city )
				+'&state='+ escape( state )
				+'&country='+ escape( country )
Link to comment
Share on other sites

  • 4 weeks later...

Thanks Dr. Rolex. I now came back to this Add-On. 

 

All escapes are now applied and and everything is fine with the forms.

 

Great Add-On. I am working on another small improvement and I will share once done.

Edited by hiorti
Link to comment
Share on other sites

I am having a problem deleting items.

 

The delete icon on ajax_checkout.php does not delete the item from the cart. I have been applying some changes and I may have damaged something but I am not sure if that's the case.The code looks good but I don't see where is the delete function executed.

 

Here are the codes in ajaxManager.js:

 

$('body').on('click', '.cart-delete', function(){
products_id = $(this).attr('rel') ;
return($(this).cartRemoveAction(products_id));
return false;
});
 
 
.....
and 
.....
 
 
 
 
$.fn.cartRemoveAction = function(productID) {
 
$('input[value=' + productID + '][name=\"cart_delete[]\"]').attr('checked', true) ;
 
// If this is the last product in cart then refresh the entire page
//
var productsInCart = parseInt( $("#content-body input[name=products_in_cart]").val() ) ;
var action = parseInt($('input[id=pl' + productID + ']').val());
action = -1 * action;
 
$.ajax({
type: 'POST',
url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1',
data: $('form[name=cart_quantity]').serialize(),
async: false,
success: function(data) {
ajaxRefreshProducts();
ajaxPerformShippingRefresh();
},
complete: function() {
if ( productsInCart + action <= 0 ) 
{
$('form[name=cart_quantity]').submit();
}
return($(this).update_cart(action));
}
});
 
return(false);
}
 
 
 
I would much appreciate any help.
 
Thanks!
 
Edited by hiorti
Link to comment
Share on other sites

One more issue that I noticed.

 

On ajax_checkout.php page when the item quantity is changed by simply entering a new number (instead of using plus or minus icons) then the cart quantity is not being updated in #headercart unless the page is refreshed.

 

So what I did as a temporary solution for me is I changed the input field into readonly, which is not the ultimate solution as the visitor may want to change the item quantity from 1 to say 10 by entering the number vs clicking on the plus icon 9 times. 

 

I believe the .blur() function could be a solution for this , however I can't figure out how to record the difference of the old and new quantity numbers for the 'action' variable. 

Edited by hiorti
Link to comment
Share on other sites

I have found the following issues that I fixed. 

 

First, when the ajax_checkout.php is loaded for the first time the CONDITION_AGREEMENT_ERROR_CREATE_ACCOUNT and CONDITIONS_CREATE_ACCOUNT constants are not defined.

 

To duplicate click on "Checkout without account" without checking the check-box "I have read and agree to the terms of use. Conditions and terms of use."

 

I noticed that both constants are defined in includes/languages/english/create_account.php. However, the include/require command for create_account.php is apparently missing. So to make it easy for me I added the 2 in include/languages/english.php file.

 

 

Secondly, again when the ajax_checkout.php is loaded for the first time and I try to create new account. I complete the new account creation form and I "accidentally" use an email address that is already in the database. So what happens is the form loads with the error message stating that the email address is found  in the database. Meanwhile, the form now is completed with the information that I filled in - except the US State name (I'm in the US) and the state field, which now is a drop-down list is empty. So if I accidentally entered an email address that is not mine (but say my brother's) and I want to change the email address and create a new account for myself, I can't select the state because the list is blank. Since I may have used the state abbreviation or the state name (i.e. CA or California) I made the below changes - in case someone can benefit from this:

 

In function showCreateAccount on lines 1871 and 1872 change:

 

$state = '';
$country = '';
 
to:
 
//$state = '';
//$country = '';
//(or you can delete them) 
 
 
in around line 2009 change: 
 
while ($zones_values = tep_db_fetch_array($zones_query)) {
$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
}
 
 
to: 
 
while ($zones_values = tep_db_fetch_array($zones_query)) {
$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
if (($state == $zones_values['zone_code']) || ($state == $zones_values['zone_name']))
 $state = $zones_values['zone_name'];
}
 

and right below (line 2022) change:

 

echo tep_draw_pull_down_menu('state', $zones_array, '', 'id="state"');
 
to:
 
echo tep_draw_pull_down_menu('state', $zones_array, $state, 'id="state"');
 
 
This should be OK. 
Link to comment
Share on other sites

One more issue that I noticed.

 

On ajax_checkout.php page when the item quantity is changed by simply entering a new number (instead of using plus or minus icons) then the cart quantity is not being updated in #headercart unless the page is refreshed.

 

So what I did as a temporary solution for me is I changed the input field into readonly, which is not the ultimate solution as the visitor may want to change the item quantity from 1 to say 10 by entering the number vs clicking on the plus icon 9 times. 

 

I believe the .blur() function could be a solution for this , however I can't figure out how to record the difference of the old and new quantity numbers for the 'action' variable. 

 

Hello Ed,

 

You can add this code to make it possible to change products quantity by manually entering a new number in the input field.

 

In ajaxManager.js find this code:

	$('body').on('click', '.cart-delete', function(){
		products_id = $(this).attr('rel') ;
		return($(this).cartRemoveAction(products_id));
		return false;
	});

Add the following code below that code:

	$( "body" ).on( "focus", ".cart-qty input", function( event ) {
		// Save Old Input value to Data object.
		$( this ).data('oldVal', $( this ).val() );

	}).on( "change", ".cart-qty input", function( event ) {
		// Get the value when input is changed
		var oldValue = $( this ).data( 'oldVal' );
		var newValue = $( this ).val();
		// Calculate difference between old and new value
		var action = newValue - oldValue;

		$.ajax({
		  type: "POST",
		  url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1',
			data: $('form[name=cart_quantity]').serialize(),
		}).done(function( data ) {
			// Refresh Products, Totals & Shipping
			ajaxRefreshProducts();
			ajaxPerformShippingRefresh();

			// Refresh Shopping Cart
			$(this).update_cart( action );

			var productsInCart = parseInt( $("#content-body input[name=products_in_cart]").val() ) ;

			// If Shopping Cart is Empty, Refresh Entire Page
			//
			if ( productsInCart <= 0 ) 
			{
				$('form[name=cart_quantity]').submit(); 
			}
		});
	});

Find this code

		if ( typeof comments != 'undefined' )

Replace With

		if ( typeof comments != 'undefined' &&
				 $( "#comments" ).length > 0 )
Link to comment
Share on other sites

 

I am having a problem deleting items.

 

The delete icon on ajax_checkout.php does not delete the item from the cart. I have been applying some changes and I may have damaged something but I am not sure if that's the case.The code looks good but I don't see where is the delete function executed.

 

Here are the codes in ajaxManager.js:

 

[...]

I would much appreciate any help.
 
Thanks!
 

 

 

Did you solve this, Ed or are you still having the same problem deleting products?

 

I did not manage to reproduce this error. Check your console for error messages.

 

You can try with replacing this code

	$('body').on('click', '.cart-delete', function(){
		products_id = $(this).attr('rel') ;
		return($(this).cartRemoveAction(products_id));
		return false;
	});

With this

	$('body').on('click', '.cart-delete', function(){
		products_id = $(this).attr('rel') ;
		alert(products_id);
		return($(this).cartRemoveAction(products_id));
		return false;
	});

Then try to delete a product, you should get a javascript prompt with the products_id.

 

Also check the 'Network' tab in Chrome's Console, there should be 6 requests where the first one should be to shopping_cart.php?show_total=1

Link to comment
Share on other sites

@@Dr. Rolex

 

Hello Jonas,

 

No actually I haven't yet. I added the alert(products_id); and I do see that the products_id is being properly recognized and transferred. However, the product is not being deleted from the cart.

 

It looks like the problem is in cartRemoveAction function - frankly I don't see the line where the mySQL delete command is being executed.

 

 

Thanks!

 

 

 

 

 

 

 

Link to comment
Share on other sites

@@Dr. Rolex

 

Hello Jonas,

 

No actually I haven't yet. I added the alert(products_id); and I do see that the products_id is being properly recognized and transferred. However, the product is not being deleted from the cart.

 

It looks like the problem is in cartRemoveAction function - frankly I don't see the line where the mySQL delete command is being executed.

 

 

Thanks!

 

Did you check the Network tab like I suggested?

 

You can, temporary for testing, find this code in ajaxManager.js

	$.fn.cartRemoveAction = function(productID) {

		$('input[value="' + productID + '"][name=\"cart_delete[]\"]').attr('checked', true) ;

		// If this is the last product in cart then refresh the entire page
		//
		var productsInCart = parseInt( $("#content-body input[name=products_in_cart]").val() ) ;
		var action = parseInt($('input[id="pl' + productID + '"]').val());
		action = -1 * action;

		$.ajax({
			type: 'POST',
			url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1',
			data: $('form[name=cart_quantity]').serialize(),
			async: false,
			success: function(data) {
				ajaxRefreshProducts();
				ajaxPerformShippingRefresh();
			},
			complete: function() {
				if ( productsInCart + action <= 0 ) 
				{
					$('form[name=cart_quantity]').submit();
				}
				return($(this).update_cart(action));
			}
		});

		return(false);	
	}

Replace with

	$.fn.cartRemoveAction = function(productID) {

		$('input[value="' + productID + '"][name=\"cart_delete[]\"]').attr('checked', true) ;

		// If this is the last product in cart then refresh the entire page
		//
		var productsInCart = parseInt( $("#content-body input[name=products_in_cart]").val() ) ;
		var action = parseInt($('input[id="pl' + productID + '"]').val());
		action = -1 * action;

		$.ajax({
			type: 'POST',
			url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1',
			data: $('form[name=cart_quantity]').serialize(),
			async: false,
			success: function(data) {
				alert( 'URL:\n' + decodeURIComponent(this.url) + "\n\n" + 'Request Payload:\n' + decodeURIComponent(this.data) );
				ajaxRefreshProducts();
				ajaxPerformShippingRefresh();
			},
			complete: function() {
				if ( productsInCart + action <= 0 ) 
				{
					$('form[name=cart_quantity]').submit();
				}
				return($(this).update_cart(action));
			}
		});

		return(false);	
	}

Now, try deleting a product again. You should get a new prompt with info like this:

URL:
https://[your_server]/ajax_checkout.php?action=update_product&show_total=1

Request Payload:
products_in_cart=1&cart_delete[]=28&cart_quantity[]=1&products_id[]=28

You'll find the delete product code in ./includes/application_top.php

 

As you see in the request URL above, the $_GET (same as $HTTP_GET_VARS) parameter update_product is set. The code below is what removes the product from the cart:

    switch ($HTTP_GET_VARS['action']) {
      // customer wants to update the product quantity in their shopping cart
      case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
                                if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
                                  $cart->remove($HTTP_POST_VARS['products_id'][$i]);
                                } else {
                                  $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
                                  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;

Perhaps you have made some modification to application_top.php or includs/classes/shopping_cart.php?

 

Also make sure that it's not just a cosmetic issue, after you have tried to remove a product, reload the page to see if the shopping cart still has the product or if it has been removed.

Link to comment
Share on other sites

  • 6 months later...

@@Dr. Rolex

 

I have been looking for a one page checkout and this is the best thing OsCommerce has going for it right now!

 

Quick question:

 

Is this addon compatible with these two addons for shipping:

 

FedEx http://addons.oscommerce.com/info/7977and USPS http://addons.oscommerce.com/info/8702

 

Thank you for the help @@Dr. Rolex

Link to comment
Share on other sites

  • 3 weeks later...
  • 9 months later...

Like the look of the checkout page, but need other payment options. If I understand correctly, this only supports paypal, COD, and authorizel.net. I would like to intergrate Stripe Payments as well. Is that possible?

Link to comment
Share on other sites

  • 4 years later...

The Fast Checkout page loads the shopping cart itself, but nothing else.  It gives an error: " Fatal error: Cannot declare class flat, because the name is already in use in /home/coyoteas/www/www/store/includes/modules/shipping/flat.php on line 13 ".  Any ideas on how to fix this?  I like the look of the Ajax cart and would like to use it.

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