Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

jQuery/Ajax Shopping Cart


delete13

Recommended Posts

Sounds more like you're giving up!? :rolleyes:

 

Why don't you use SSL on all pages instead?

 

 

hehehehehehe i was about to give up :P

SNAP!!!

EUREKA!!

 

It is not a configuration error fortunately. It has something to do with the page displaying insecure content when editing the shopping cart on a ssl connection. This makes a lot of sense because on a page with an ssl connection, on my server anyways, it won't display corretly if it has insecure content. One step closer.

Link to comment
Share on other sites

 

 

The page at
displayed insecure content from
.

 

The page at
displayed insecure content from
.

 

 

This is the error which has showed.
Edited by Hussey07
Link to comment
Share on other sites

Thank you very much Dr. Rolex

.

Really good job! For me, at first glance, everything seems to work properly. Nevertheless, I have a few questions.

 

Is there a way to display product thumbnails in the small shopping_cart?

 

And one more thing, it is of course an interesting solution, showing the delete button when you hover over the quantity button (small shopping_cart). But for the viewer, this delete button is a hidden function that he will probably never find. Why he should know that he have to hover the quantity button to delete something. I would display the delete button always next to quantity button.

Link to comment
Share on other sites

Thank you very much Dr. Rolex

.

Really good job! For me, at first glance, everything seems to work properly. Nevertheless, I have a few questions.

 

Is there a way to display product thumbnails in the small shopping_cart?

 

And one more thing, it is of course an interesting solution, showing the delete button when you hover over the quantity button (small shopping_cart). But for the viewer, this delete button is a hidden function that he will probably never find. Why he should know that he have to hover the quantity button to delete something. I would display the delete button always next to quantity button.

 

I am actually in the middle of doing a solution to this. If you have any knowledge of jquery and understand the file setup for this add-on then it is quite easy to fix. What i would do is just replicate the delete function as a seperate button. Simples no :-

Link to comment
Share on other sites

OMG this is spooky (w00t)

 

When i change everything to https in the configure file, it works.

 

Thanks so much for your help drRolex. Here is a thumbs up :thumbsup: and a great white smile :D

 

However i heard that making everything https will affect the search engine rankings which is :x :x

 

So i am trying to find what is giving the insecure content

Link to comment
Share on other sites

also something is happening in jquery-oscart.js

 

 

 

$.fn.addBasket jquery-oscart.js:475

$.droppable.drop jquery-oscart.js:372

 

 

Thats the error that i am getting from the jquery-oscart.js.

 

Then when i click on addBasket this is shown:

 

$.ajax({

type: 'POST',

url: encodeURI($('form[name=cart_quantity-' + attrForm + productID + ']').attr('action')) + '&show_total=1&ajax=1',

data: $('form[name=cart_quantity-' + attrForm + productID + ']').serialize(),

async:false,

success: function(data) {

$('#boxcart-total').html(data);

return($(this).update_cart(total));

}

});

 

This might be what is giving me the error.

Edited by Hussey07
Link to comment
Share on other sites

Thank you very much Dr. Rolex

.

Really good job! For me, at first glance, everything seems to work properly. Nevertheless, I have a few questions.

 

Is there a way to display product thumbnails in the small shopping_cart?

 

And one more thing, it is of course an interesting solution, showing the delete button when you hover over the quantity button (small shopping_cart). But for the viewer, this delete button is a hidden function that he will probably never find. Why he should know that he have to hover the quantity button to delete something. I would display the delete button always next to quantity button.

 

Don't change the PHP or Javascript code, the correct way to fix this is to modify your stylesheet.css

 

This is the great thing about having everything 100% css, it's very easy to modify.

 

Open your ./stylesheet.css

 

Find this section:

.basket ul li button.delete {
position: absolute;
right: 2px;
top: 3px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity = 0);
opacity: 0;
width: 20px;
/* line-height: 20px;
*/ height: 20px;
text-align: center;
font-size: 11px;
border: 0;
color: #EE5757;
background-color: #eee;
border-radius: 3px;
cursor: pointer;
-webkit-transition: opacity .2s ease;
-moz-transition: opacity .2s ease;
-o-transition: opacity .2s ease;
-ms-transition: opacity .2s ease;
transition: opacity .2s ease;
}

 

Play with this until you get what you want and don't forget to check in all browsers so everything looks ok.

 

Easy fix:

Change this property to the value below to position the delete button to the left of the product counter:

right: 25px;

 

Change this property to the value below to always show the delete button:

opacity: 1;

 

 

Also, to disable the "hiding effect" of the counter on hover, find this code in stylesheet.css:

.basket ul li span.name {
   display: block;
   float: left;
   width: 100px;
   font-weight: bold;
   white-space: nowrap;
   overflow: hidden;
   -o-text-overflow: ellipsis;
   -ms-text-overflow: ellipsis;
   text-overflow: ellipsis;
   -webkit-transition: width .2s ease;
   -moz-transition: width .2s ease;
   -o-transition: width .2s ease;
   -ms-transition: width .2s ease;
   transition: width .2s ease;
}

 

Comment out the display and float property, so it look something like this:

/* display: block;

float: left;*/

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

More specifically this line url: encodeURI($('form[name=cart_quantity-' + attrForm + productID + ']').attr('action')) + '&show_total=1&ajax=1'

 

is giving me the error. Isn't there any other way to get the url, because i tried editing the url to a full url of my site and it somewhat worked with deleting a product which was already in the shopping cart, however there are multiple other errors.

There are multiple ajax calls to post which have this type of url. I think this could be a problem for the https urls.

Edited by Hussey07
Link to comment
Share on other sites

also something is happening in jquery-oscart.js

 

 

 

$.fn.addBasket jquery-oscart.js:475

$.droppable.drop jquery-oscart.js:372

 

 

Thats the error that i am getting from the jquery-oscart.js.

 

Then when i click on addBasket this is shown:

 

$.ajax({

type: 'POST',

url: encodeURI($('form[name=cart_quantity-' + attrForm + productID + ']').attr('action')) + '&show_total=1&ajax=1',

data: $('form[name=cart_quantity-' + attrForm + productID + ']').serialize(),

async:false,

success: function(data) {

$('#boxcart-total').html(data);

return($(this).update_cart(total));

}

});

 

This might be what is giving me the error.

 

The problem is that you are sending the AJAX POST to:

http://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1

 

Note the http://

 

From:

https://www.mysite.com/login.php

 

Note the https://

 

The browser interprets this as a POST to a remote website, for the browser this is equal as if your site was https://www.microsoft.com/login.php.

 

You have to fix so that the POST will be to https://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1 while you are on https://www.mysite.com/login.php

 

- OR -

 

You have to fix so that the POST will be to http://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1 while you are on http://www.mysite.com/login.php

 

Why should a SSL connection lower your search engine rankings?

 

I have everything SSL and I'm on top of the list, baby! :thumbsup:

Link to comment
Share on other sites

The problem is that you are sending the AJAX POST to:

http://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1

 

Note the http://

 

From:

https://www.mysite.com/login.php

 

Note the https://

 

The browser interprets this as a POST to a remote website, for the browser this is equal as if your site was https://www.microsoft.com/login.php.

 

You have to fix so that the POST will be to https://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1 while you are on https://www.mysite.com/login.php

 

- OR -

 

You have to fix so that the POST will be to http://www.mysite.com/shopping_cart.php?action=update_product&show_total=1&ajax=1 while you are on http://www.mysite.com/login.php

 

Why should a SSL connection lower your search engine rankings?

 

I have everything SSL and I'm on top of the list, baby! :thumbsup:

 

Would i be right in thinking that i would have to write out the full url for it to work? or is there any other way to do it?

 

Sorry for the trouble.

 

If this doesn't work then i will just use everything ssl :)

Link to comment
Share on other sites

Would i be right in thinking that i would have to write out the full url for it to work? or is there any other way to do it?

 

Sorry for the trouble.

 

If this doesn't work then i will just use everything ssl :)

 

No problem at all. ;)

 

Actually, I think I have found a solution to your problem. If you want to have a mixed SSL and non SSL connection then you have to change the tep_draw_form in all of the boxes.

 

Find (code might differ between different files, this one is for bm_whats_new.php):

tep_draw_form('cart_quantity-whatsnew-' . $random_product['products_id'] . '', tep_href_link(FILENAME_DEFAULT, 'products_id='.$random_product['products_id'] . '&action=add_product'))

Change to:

tep_draw_form('cart_quantity-whatsnew-' . $random_product['products_id'] . '', tep_href_link(FILENAME_DEFAULT, 'products_id='.$random_product['products_id'] . '&action=add_product', ($_SERVER['SERVER_PORT'] == '443' ? 'SSL' : 'NONSSL')))

 

Basically, in the tep_href_link function inside the tep_draw_form function you need to add the code below right before the ending ) (for the tep_href_link):

, ($_SERVER['SERVER_PORT'] == '443' ? 'SSL' : 'NONSSL'))

Link to comment
Share on other sites

No problem at all. ;)

 

Actually, I think I have found a solution to your problem. If you want to have a mixed SSL and non SSL connection then you have to change the tep_draw_form in all of the boxes.

 

Find (code might differ between different files, this one is for bm_whats_new.php):

tep_draw_form('cart_quantity-whatsnew-' . $random_product['products_id'] . '', tep_href_link(FILENAME_DEFAULT, 'products_id='.$random_product['products_id'] . '&action=add_product'))

Change to:

tep_draw_form('cart_quantity-whatsnew-' . $random_product['products_id'] . '', tep_href_link(FILENAME_DEFAULT, 'products_id='.$random_product['products_id'] . '&action=add_product', ($_SERVER['SERVER_PORT'] == '443' ? 'SSL' : 'NONSSL')))

 

Basically, in the tep_href_link function inside the tep_draw_form function you need to add the code below right before the ending ) (for the tep_href_link):

, ($_SERVER['SERVER_PORT'] == '443' ? 'SSL' : 'NONSSL'))

 

Without going over the top, but you are awesome. It has been solved. Yaaaayyyyyyyyyyyy Thankyou so much. Love you Love you Love you :rolleyes:

 

You are a hero :D

 

By the way what is your stores name? i want to visit it. Maybe buy something ;)

Link to comment
Share on other sites

Without going over the top, but you are awesome. It has been solved. Yaaaayyyyyyyyyyyy Thankyou so much. Love you Love you Love you :rolleyes:

 

You are a hero :D

 

By the way what is your stores name? i want to visit it. Maybe buy something ;)

 

Haha, glad I could help. B)

 

Btw, I have just finished a new Ajax/jQuery One Page Checkout/Shopping Cart/Create Account/Login Add-On that I think you will like.

 

The ones that already exist haven't worked for me, this Add-On is based on Advance Software free "AJAX checkout for OsCommerce".

I have rewritten the code so it works on osCommerce 2.3.3 and added many features.

 

Hopefully this one will work for most people out of the box. I haven't tried it with this Add-on yet (jQuery/Ajax Shopping Cart) but I added instructions on the bottom of the readme.html file that maybe are enough to get them to work together in harmony. (w00t)

 

Store? Who told you I have a store? ;)

It's a secret to everybody.

 

Oh and Baumfist, I'll see what I can do with the product thumbnails added to the cart when I got time. The problem is that it's (the cart) so small, but maybe we can squeeze them together somehow.

Link to comment
Share on other sites

Haha, glad I could help. B)

 

Btw, I have just finished a new Ajax/jQuery One Page Checkout/Shopping Cart/Create Account/Login Add-On that I think you will like.

 

The ones that already exist haven't worked for me, this Add-On is based on Advance Software free "AJAX checkout for OsCommerce".

I have rewritten the code so it works on osCommerce 2.3.3 and added many features.

 

Hopefully this one will work for most people out of the box. I haven't tried it with this Add-on yet (jQuery/Ajax Shopping Cart) but I added instructions on the bottom of the readme.html file that maybe are enough to get them to work together in harmony. (w00t)

 

Store? Who told you I have a store? ;)

It's a secret to everybody.

 

Oh and Baumfist, I'll see what I can do with the product thumbnails added to the cart when I got time. The problem is that it's (the cart) so small, but maybe we can squeeze them together somehow.

 

I am excited to see this new add-on. It sounds like something that might also be a hit with the other os-commerce users.

 

hahahahahaa :lol: i'll be waiting to see this store :D

Link to comment
Share on other sites

I would like to make the button an image instead that deletes, the product from within the cart. Is the editing done within the js-oscart file? I looked at the previous version which uses an image and it seems so.

 

edit: Solved it B)

Edited by Hussey07
Link to comment
Share on other sites

I would like to make the button an image instead that deletes, the product from within the cart. Is the editing done within the js-oscart file? I looked at the previous version which uses an image and it seems so.

 

edit: Solved it B)

 

not solved :(

Link to comment
Share on other sites

not solved :(

 

I don't have so much time right now to help, but if you remove all the Javascript code that renders the shopping cart box, and then replace the current ajax POST to boxcart_quanity to this:

// Updating cart total
//
$.ajax({
type: 'POST',
url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&updateCart=1&ajax=1',
data: $('form').serialize(),
success: function(data) {
$('#span_cart_box').html(data);
}
});

 

Also, you can change your ./includes/modules/boxes/bm_shopping_cart.php to this:

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 class bm_shopping_cart {
   var $code = 'bm_shopping_cart';
   var $group = 'boxes';
   var $title;
   var $description;
   var $sort_order;
   var $enabled = false;
   function bm_shopping_cart() {
  $this->title = MODULE_BOXES_SHOPPING_CART_TITLE;
  $this->description = MODULE_BOXES_SHOPPING_CART_DESCRIPTION;
  if ( defined('MODULE_BOXES_SHOPPING_CART_STATUS') ) {
    $this->sort_order = MODULE_BOXES_SHOPPING_CART_SORT_ORDER;
    $this->enabled = (MODULE_BOXES_SHOPPING_CART_STATUS == 'True');
    $this->group = ((MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
  }
   }
   function execute() {
  global $cart, $new_products_id_in_cart, $currencies, $oscTemplate;
  if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' )
  {
  $cart_contents_string = '';
  $cart_contents_string .= tep_draw_form('boxcart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product'), null, 'id="span_cart_box"');
 // end of XMLHttpRequest condition
   }
  if ($cart->count_contents() > 0) {
    $cart_contents_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="0" class="ui-widget-content infoBoxContents">';
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	  $cart_contents_string .= '<tr><td align="right" valign="top">';
	  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	    $cart_contents_string .= '<span class="newItemInCart">';
	  }
	  $cart_contents_string .= $products[$i]['quantity'] . ' x ';
	  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	    $cart_contents_string .= '</span>';
	  }
	  $cart_contents_string .= '</td><td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
	  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	    $cart_contents_string .= '<span class="newItemInCart">';
	  }
	  $cart_contents_string .= $products[$i]['name'];
	  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	    $cart_contents_string .= '</span>';
	  }
	  $cart_contents_string .= '</a></td></tr>';
	  if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	    tep_session_unregister('new_products_id_in_cart');
	  }
    }
    $cart_contents_string .= '<tr><td colspan="2" style="padding-top: 5px; padding-bottom: 2px;">' . tep_draw_separator() . '</td></tr>' .
							 '<tr><td colspan="2" align="right">' . $currencies->format($cart->show_total()) . '</td></tr></table>';
if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' )
{
	 $cart_contents_string .= '</form>';
}

if ( isset($_GET['updateCart']) && (int)$_GET['ajax']  )
  {
   echo $cart_contents_string;
   die ;
  }

  } else {
    $cart_contents_string .= '<div class="ui-widget-content infoBoxContents">' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</div></form>';
  }
  $data = '<div class="ui-widget infoBoxContainer">' .
		  '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' .
		  '  ' . $cart_contents_string .
		  '</div>';
  $oscTemplate->addBlock($data, $this->group);
   }
   function isEnabled() {
  return $this->enabled;
   }
   function check() {
  return defined('MODULE_BOXES_SHOPPING_CART_STATUS');
   }
   function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shopping Cart Module', 'MODULE_BOXES_SHOPPING_CART_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
   }
   function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
   function keys() {
  return array('MODULE_BOXES_SHOPPING_CART_STATUS', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER');
   }
 }
?>

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

I don't have so much time right now to help, but if you remove all the Javascript code that renders the shopping cart box, and then replace the current ajax POST to boxcart_quanity to this:

// Updating cart total
//
$.ajax({
type: 'POST',
url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&updateCart=1&ajax=1',
data: $('form').serialize(),
success: function(data) {
$('#span_cart_box').html(data);
}
});

 

Also, you can change your ./includes/modules/boxes/bm_shopping_cart.php to this:

<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
class bm_shopping_cart {
var $code = 'bm_shopping_cart';
var $group = 'boxes';
var $title;
var $description;
var $sort_order;
var $enabled = false;
function bm_shopping_cart() {
 $this->title = MODULE_BOXES_SHOPPING_CART_TITLE;
 $this->description = MODULE_BOXES_SHOPPING_CART_DESCRIPTION;
 if ( defined('MODULE_BOXES_SHOPPING_CART_STATUS') ) {
 $this->sort_order = MODULE_BOXES_SHOPPING_CART_SORT_ORDER;
 $this->enabled = (MODULE_BOXES_SHOPPING_CART_STATUS == 'True');
 $this->group = ((MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
 }
}
function execute() {
 global $cart, $new_products_id_in_cart, $currencies, $oscTemplate;
if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' )
{
 $cart_contents_string = '';
$cart_contents_string .= tep_draw_form('boxcart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product'), null, 'id="span_cart_box"');
 // end of XMLHttpRequest condition
}
 if ($cart->count_contents() > 0) {
 $cart_contents_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="0" class="ui-widget-content infoBoxContents">';
 $products = $cart->get_products();
 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	 $cart_contents_string .= '<tr><td align="right" valign="top">';
	 if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	 $cart_contents_string .= '<span class="newItemInCart">';
	 }
	 $cart_contents_string .= $products[$i]['quantity'] . ' x ';
	 if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	 $cart_contents_string .= '</span>';
	 }
	 $cart_contents_string .= '</td><td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
	 if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	 $cart_contents_string .= '<span class="newItemInCart">';
	 }
	 $cart_contents_string .= $products[$i]['name'];
	 if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	 $cart_contents_string .= '</span>';
	 }
	 $cart_contents_string .= '</a></td></tr>';
	 if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
	 tep_session_unregister('new_products_id_in_cart');
	 }
 }
 $cart_contents_string .= '<tr><td colspan="2" style="padding-top: 5px; padding-bottom: 2px;">' . tep_draw_separator() . '</td></tr>' .
							 '<tr><td colspan="2" align="right">' . $currencies->format($cart->show_total()) . '</td></tr></table>';
if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' )
{
	 $cart_contents_string .= '</form>';
}

if ( isset($_GET['updateCart']) && (int)$_GET['ajax'] )
{
echo $cart_contents_string;
 die ;
}

 } else {
 $cart_contents_string .= '<div class="ui-widget-content infoBoxContents">' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</div></form>';
 }
 $data = '<div class="ui-widget infoBoxContainer">' .
		 ' <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' .
		 ' ' . $cart_contents_string .
		 '</div>';
 $oscTemplate->addBlock($data, $this->group);
}
function isEnabled() {
 return $this->enabled;
}
function check() {
 return defined('MODULE_BOXES_SHOPPING_CART_STATUS');
}
function install() {
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shopping Cart Module', 'MODULE_BOXES_SHOPPING_CART_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
}
function remove() {
 tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
 return array('MODULE_BOXES_SHOPPING_CART_STATUS', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER');
}
}
?>

 

None of these options worked. I think i might just use the original way :) Thanks for everything anyhow.

Link to comment
Share on other sites

Thank you for your help! The thing with the delete button has worked well.

 

"Oh and Baumfist, I'll see what I can do with the product thumbnails added to the cart when i got time. Did The problem is it's (the cart) so small, but maybe we can squeeze them together somehow."

 

That's what I was thinking, maybe you can make the thumbnails smaller percentage. They could well be less than in the big shopping_cart.

Link to comment
Share on other sites

I have uploaded the One Page Checkout Add-on.

 

I haven't tried it myself yet with this Add-On, but if you try it it might work if you change this in bm_shopping_cart.php:

 

Change this:

$cart_contents_string = '';
$cart_contents_string = tep_draw_form('boxcart_quantity',
tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product'));
if ($cart->count_contents() > 0) {

To this:

if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' ) {
$cart_contents_string = '';
$cart_contents_string = tep_draw_form('boxcart_quantity',
tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product'));

// end of XMLHttpRequest condition
//
 }
if ($cart->count_contents() > 0) {

 

Change this:

} else {
$cart_contents_string .= '<ul class="" style="" id="boxcart-content">';
$cart_contents_string .= '<li style="font-size:11px; float:right;">' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</li></ul>';

To this:

if ( (int)$_GET['ajax'] != 1 && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' )
{
$cart_contents_string .= '</form>';
}
if ( isset($_GET['updateCart']) && (int)$_GET['ajax'] )
{
echo $cart_contents_string;
die ;
}
} else {
$cart_contents_string .= '<ul class="" style="" id="boxcart-content">';
$cart_contents_string .= '<li style="font-size:11px; float:right;">' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</li></ul>';

 

 

In template_top.php:

 

Change this:

<?php if (basename($PHP_SELF) != FILENAME_SHOPPING_CART){ ?>

 

To this:

<?php if (basename($PHP_SELF) != FILENAME_SHOPPING_CART OR basename($PHP_SELF) !
= FILENAME_AJAX_CHECKOUT){ ?>

 

 

Then add this to ./includes/filenames.php

define('FILENAME_AJAX_CHECKOUT', 'ajax_checkout.php');

 

 

In includes/header.php find:

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

 

Replace with:

tep_draw_button(HEADER_TITLE_FAST_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_AJAX_CHECKOUT, '', 'SSL')) .

 

You might want to add a button to shopping_cart.php also, check the readme file in the package for more info.

 

 

jQuery/Ajax Fast checkout/Shopping Cart/Login/Create Account 2.3.3

Ajax Fast checkout Support Forum

Link to comment
Share on other sites

  • 2 weeks later...

A small cosmetic patch that I recommend everybody who use this Add-On to apply (fixes the explosion when product is dropped on cart):

 

Find in ./ext/modules/shopping_cart/jquery-oscart.js around line 363:

drop:function (event, ui) {
// Explode on successful drop to basket
//
$(ui.helper)
.toggle('explode', { direction: 'down' });
// and slide up the original product
//
$('#cart-clone')
.toggle('slide', { direction: 'down' }, 'fast');
$('.ui-widget', '#bodyWrapper')
.animate({
opacity:1
}, 1000);
var productID = ui.draggable.attr("id");
var attrForm = ui.draggable.attr('data-id');
return($(this).addBasket(productID, attrForm));
}
});

Replace with:

drop:function (event, ui) {

// and slide up the original product
//
$('#cart-clone')
.toggle('slide', { direction: 'down' }, 'fast');
$('.ui-widget', '#bodyWrapper')
.animate({
opacity:1
}, 1000);
// Explode on successful drop to basket
//
$(ui.helper)
.toggle('explode', function() {

 var productID = ui.draggable.attr("id");
 var attrForm = ui.draggable.attr('data-id');
 return($(this).addBasket(productID, attrForm));
});
}
});

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