Jump to content
boxtel

2gether Discount

Recommended Posts

Hi there,

 

I was just installing the contribution and came across a problem or two. I managed to clear up some of them myself but I still have a problem with the sql.

 

When I added the sql to the database I got this message

SQL-query : [Edit] [Create PHP Code]

DROP TABLE IF EXISTS products_2gether;# MySQL returned an empty result set (i.e. zero rows).

CREATE TABLE products_2gether(

tid int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,

product_1_id int( 11 ) unsigned NOT NULL default '0',

product_2_id int( 11 ) unsigned NOT NULL default '0',

discount float NOT NULL default '5',

TYPE char( 1 ) NOT NULL default 'p',

STATUS int( 1 ) unsigned NOT NULL default '0',

PRIMARY KEY ( tid ) ,

KEY producta( product_1_id, product_2_id, STATUS )

) TYPE = MYISAM ;# MySQL returned an empty result set (i.e. zero rows).

 

And when I clicked on 2gether from the Admin/catalog panel I got this error message

 

1146 - Table 'bujin.table_2gether' doesn't exist

 

select count(*) as total from TABLE_2GETHER

 

[TEP STOP]

 

I'm afraid that I am not smart enough to figure this out by myself so any help would be appreciated.

 

Thanks

Share this post


Link to post
Share on other sites
Hi there,

 

I was just installing the contribution and came across a problem or two. I managed to clear up some of them myself but I still have a problem with the sql.

 

When I added the sql to the database I got this message

SQL-query : [Edit] [Create PHP Code]

DROP TABLE IF EXISTS products_2gether;# MySQL returned an empty result set (i.e. zero rows).

CREATE TABLE products_2gether(

tid int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,

product_1_id int( 11 ) unsigned NOT NULL default '0',

product_2_id int( 11 ) unsigned NOT NULL default '0',

discount float NOT NULL default '5',

TYPE char( 1 ) NOT NULL default 'p',

STATUS int( 1 ) unsigned NOT NULL default '0',

PRIMARY KEY ( tid ) ,

KEY producta( product_1_id, product_2_id, STATUS )

) TYPE = MYISAM ;# MySQL returned an empty result set (i.e. zero rows).

 

And when I clicked on 2gether from the Admin/catalog panel I got this error message

 

1146 - Table 'bujin.table_2gether' doesn't exist

 

select count(*) as total from TABLE_2GETHER

 

[TEP STOP]

 

I'm afraid that I am not smart enough to figure this out by myself so any help would be appreciated.

 

Thanks

 

 

you did not do this :

 

3) add to includes/database_tables.php in admin and catalog

 

define('TABLE_2GETHER', 'products_2gether');


Treasurer MFC

Share this post


Link to post
Share on other sites
you did not do this :

 

3) add to includes/database_tables.php in admin and catalog

 

define('TABLE_2GETHER', 'products_2gether');

 

Thank you very much. I missed it in admin!

 

Cheers

Share this post


Link to post
Share on other sites

Hi Amanda!

 

Wow! Not only your work is great but I?m also impressed with how much you help people with their different queries. I hope to be as good as you are in php one day?

 

Now, I was looking to bring a few changes to your contribution... and miserably failed. Maybe you might be able to help, here?

 

I?d like two things:

  1. to have the discount prices displayed in the shopping cart, a bit like the specials are in the listing: price crossed over and discounted price in red next to the original price.
  2. I would love to have the final price displayed in the checkout_confirmation page. At the moment, there is:

Sub-total

Flat rate

Tax

Total

Discount

 

?and I would like to have ?Final Price? displayed at the end of the list with the amount the customer will really pay.

Same with the shopping cart, it could be good if the prices displayed were the ones with the discount included, so the customer knows what the real amount of his/her shopping basket is.

 

I know enough about php to deal with most general problems, but I?m quiet new with the object oriented side (php or not) and I didn?t really understand how the $order_total_modules class works yet. Any help would be wonderful!

 

Thanks a lot!

 

Charles.

Share this post


Link to post
Share on other sites
Hi Amanda!

 

Wow! Not only your work is great but I?m also impressed with how much you help people with their different queries. I hope to be as good as you are in php one day?

 

Now, I was looking to bring a few changes to your contribution... and miserably failed. Maybe you might be able to help, here?

 

I?d like two things:

  1. to have the discount prices displayed in the shopping cart, a bit like the specials are in the listing: price crossed over and discounted price in red next to the original price.
  2. I would love to have the final price displayed in the checkout_confirmation page. At the moment, there is:

Sub-total

Flat rate

Tax

Total

Discount

 

?and I would like to have ?Final Price? displayed at the end of the list with the amount the customer will really pay.

Same with the shopping cart, it could be good if the prices displayed were the ones with the discount included, so the customer knows what the real amount of his/her shopping basket is.

 

I know enough about php to deal with most general problems, but I?m quiet new with the object oriented side (php or not) and I didn?t really understand how the $order_total_modules class works yet. Any help would be wonderful!

 

Thanks a lot!

 

Charles.

 

you can display the discount before the total by setting the sort order of the module to be lower than the one of the total in your administration side.

 

the displaying of the adjusted prices in the cart is a little more difficult but possible.

In the shopping_cart.php the discount is availabe and for those products the variable :

 

$together_offer_ok

 

is set when both products of that discount are present in the basket.

when displaying the products price you can do a test on that variable and if set to true, calculate the new price with the discount and display the old price crossed out and the new price next to it.


Treasurer MFC

Share this post


Link to post
Share on other sites

1) The two products get added, but the discount does not show and doesn't calculate into the total.

 

2) Also, the products are downloadable. Will the checkout process allow them both to be downloaded?

 

Thanks!

Share this post


Link to post
Share on other sites
1) The two products get added, but the discount does not show and doesn't calculate into the total.

 

2) Also, the products are downloadable. Will the checkout process allow them both to be downloaded?

 

Thanks!

1) make sure the order total module is installed and has a correct sort order

 

2) downloads have nothing to do with discounting.


Treasurer MFC

Share this post


Link to post
Share on other sites
1) make sure the order total module is installed and has a correct sort order

 

2) downloads have nothing to do with discounting.

 

Okay. The sort order fixed the first issue.

 

The second issue is that if I bundle two downloadable products, the option to download them does not show up in the "Your Order Has Been Processed" page. If I order them separtely (not within a 2gether package), the download links show up.

 

Thanks so much for an awesome module and for your support!

Share this post


Link to post
Share on other sites
Okay. The sort order fixed the first issue.

 

The second issue is that if I bundle two downloadable products, the option to download them does not show up in the "Your Order Has Been Processed" page. If I order them separtely (not within a 2gether package), the download links show up.

 

Thanks so much for an awesome module and for your support!

 

the only reason I can think of is that the 2gether form does not contain attibutes. As download is part of the attributes system it will probably not set them and thus the products are not recognized as downloads.

If you add both to the cart via their separate product info page it would probably work.


Treasurer MFC

Share this post


Link to post
Share on other sites
the only reason I can think of is that the 2gether form does not contain attibutes. As download is part of the attributes system it will probably not set them and thus the products are not recognized as downloads.

If you add both to the cart via their separate product info page it would probably work.

 

How could I rig 2gether to work with attributes? Apparently the Buy_Two module is supposed to work with attributes, but I can't get that to work, and no one is responding to that forum.

 

Do you have any ideas for how I can get the attributes to pass so that it works? If I add the items separate, the download works without the discount. If I add the items together, the discount works without the download.

 

Thanks!

Share this post


Link to post
Share on other sites
How could I rig 2gether to work with attributes? Apparently the Buy_Two module is supposed to work with attributes, but I can't get that to work, and no one is responding to that forum.

 

Do you have any ideas for how I can get the attributes to pass so that it works? If I add the items separate, the download works without the discount. If I add the items together, the discount works without the download.

 

Thanks!

 

the problem with attributes is that it effectively alters the product id when it enters the cart.

if you have a product 12 it may become 12{3}2 or 12{3}3 when it is entered into the cart.

That makes it much more difficult for compare as the cart function in_cart() simply compares the product_id

string and has no ability to make a clean comparison without the added attribute characters.

So you would have to alter the 2gether logic to start in the cart, strip the product ids with get_prid() and then compare. You could also alter the in_cart() function so that you can give it an additional parameter so that you can choose whether you wish to compare the product with or without attributes.

 

add a function which does that so the in_cart() function remains the same.

 

function in_cart_clean($comb_id) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if ($comb_id == get_prid($products_id)) return true;

}

return false;

}

 

function in_cart($products_id, $clean = false) {

if ($clean) return $this->in_cart_clean($products_id);

if (isset($this->contents[$products_id])) {

return true;

} else {

return false;

}

}

 

then if you wish to know if product 12 is in the cart regardless of attributes you say : if (in_cart(12,true))

which should return true if 12{3}2 is in the cart or 12{3}3 as it simply compares the original product id.

 

that still leaves open that you would have to add the attributes to the 2gether form if you want them to be recognized via the add together button or force them to be added from their individual product pages if products have attributes.


Treasurer MFC

Share this post


Link to post
Share on other sites
the problem with attributes is that it effectively alters the product id when it enters the cart.

if you have a product 12 it may become 12{3}2 or 12{3}3 when it is entered into the cart.

That makes it much more difficult for compare as the cart function in_cart() simply compares the product_id

string and has no ability to make a clean comparison without the added attribute characters.

So you would have to alter the 2gether logic to start in the cart, strip the product ids with get_prid() and then compare. You could also alter the in_cart() function so that you can give it an additional parameter so that you can choose whether you wish to compare the product with or without attributes.

 

add a function which does that so the in_cart() function remains the same.

 

function in_cart_clean($comb_id) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if ($comb_id == get_prid($products_id)) return true;

}

return false;

}

 

function in_cart($products_id, $clean = false) {

if ($clean) return $this->in_cart_clean($products_id);

if (isset($this->contents[$products_id])) {

return true;

} else {

return false;

}

}

 

then if you wish to know if product 12 is in the cart regardless of attributes you say : if (in_cart(12,true))

which should return true if 12{3}2 is in the cart or 12{3}3 as it simply compares the original product id.

 

that still leaves open that you would have to add the attributes to the 2gether form if you want them to be recognized via the add together button or force them to be added from their individual product pages if products have attributes.

 

I'm a little confused. What is the purpose of changing the in_cart function? Wouldn't I just need to get the attributes to pass in the 2gether form?

 

The issue that I'm having is I'm not sure how exactly to get either the attributes to pass in the 2gether form or to add the products from the individual product info pages. The attributes for both products would have to be passed.

 

The feedback is great. I have an idea of where to go; I'm just not sure how to do it.

Share this post


Link to post
Share on other sites
I'm a little confused. What is the purpose of changing the in_cart function? Wouldn't I just need to get the attributes to pass in the 2gether form?

 

The issue that I'm having is I'm not sure how exactly to get either the attributes to pass in the 2gether form or to add the products from the individual product info pages. The attributes for both products would have to be passed.

 

The feedback is great. I have an idea of where to go; I'm just not sure how to do it.

 

the issue is that when a product is added to the cart with attributes, the products_id changes.

 

so if you add product 12 to the cart with attributes it becomes something like 12{3}2

 

the normal in_cart() function simply does an isset compare in the cart.

 

so if you have together id's of 12 and 14 and product 12 has attributes then if you add both to the cart, the cart will hold :

 

12{3}2 and 14

 

if together then tries to determine if the combination 12 and 14 are in the cart it will find 14 but not 12 when using the standard in_cart() function.

 

so for products with attributes you would have to strip the attributes additions from the cart's product id before comparing. That is what the additional function does. it is put into an additional function because in_cart() is used often so you do not want that functionality to change.


Treasurer MFC

Share this post


Link to post
Share on other sites
the issue is that when a product is added to the cart with attributes, the products_id changes.

 

so if you add product 12 to the cart with attributes it becomes something like 12{3}2

 

the normal in_cart() function simply does an isset compare in the cart.

 

so if you have together id's of 12 and 14 and product 12 has attributes then if you add both to the cart, the cart will hold :

 

12{3}2 and 14

 

if together then tries to determine if the combination 12 and 14 are in the cart it will find 14 but not 12 when using the standard in_cart() function.

 

so for products with attributes you would have to strip the attributes additions from the cart's product id before comparing. That is what the additional function does. it is put into an additional function because in_cart() is used often so you do not want that functionality to change.

 

I changed the in_cart function as you specified. How do I go about getting the attributes to pass in the 2gether form or how do I make the 2gether button add the items from the original product info pages?

Share this post


Link to post
Share on other sites
I changed the in_cart function as you specified. How do I go about getting the attributes to pass in the 2gether form or how do I make the 2gether button add the items from the original product info pages?

 

well, you would have to add the attributes to the 2gether form.

but because you would now have possibly 2 sets of attributes on there (2 dropdown boxes) you need to alter there names so they are unique.

I personally would remove the attibutes code from the product info page and put it in an includes file called products_attributes.php file which you then include in product_info.php. That way you can include the attributes anywhere in a simple way.

 

You would then also include it 2 times in the 2gether discount module, 1x for each product.

That includes file would have to take a variable because the product you wish to display the attributes for are different from the displayed product. In other words, you first set a check_id which is the products id you want the attributes for. If you do not, the includes file simply uses the products_id from the GET array as usual.

 

so the includes file products_attributes.php looks like this:

 

<?php

ob_start();

if ($check_id == '') {

$check_id = $HTTP_GET_VARS['products_id'];

}

 

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$check_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellpadding="1">

<?php

$products_options_name_query = tep_db_query("select distinct popt.products_options_id,

popt.products_options_name

from " . TABLE_PRODUCTS_OPTIONS . " popt,

" . TABLE_PRODUCTS_ATTRIBUTES . " patrib

where patrib.products_id='" . (int)$check_id . "'

and patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id . "'

order by popt.products_options_name");

 

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$products_options_array = array();

$products_options_query = tep_db_query("select pov.products_options_values_id,

pov.products_options_values_name,

pa.options_values_price,

pa.price_prefix

from " . TABLE_PRODUCTS_ATTRIBUTES . " pa,

" . TABLE_PRODUCTS_OPTIONS_VALUES . " pov

where pa.products_id = '" . (int)$check_id . "'

and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "'

and pa.options_values_id = pov.products_options_values_id

and pov.language_id = '" . (int)$languages_id . "'

order by pov.products_options_values_name");

 

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

if (isset($cart->contents[$check_id]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$check_id]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<tr>

<td nowrap><?php echo $products_options_name['products_options_name'] . '</td><td>'. tep_draw_pull_down_menu('id'.$check_id.'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute,' style="vertical-align:middle" class="inputbox" '); ?></td>

</tr>

<?php

}

?>

</table>

<?php

}

$attributes_string = ob_get_clean();

?>

 

the include code on the standard product info page which would replace the normal attributes code looks like this:

 

include(DIR_WS_INCLUDES . 'product_attributes.php');

echo $attributes_string;

 

 

 

the include code for the 2gether discount display module looks like this:

 

for the first product:

 

$check_id = $product_a['products_id'];

include(DIR_WS_INCLUDES . 'product_attributes.php');

if ($attributes_string != '') echo '<br>'.$attributes_string;

 

 

and for the second product:

 

$check_id = $product_b['products_id'];

include(DIR_WS_INCLUDES . 'product_attributes.php');

if ($attributes_string != '') echo '<br>'.$attributes_string;

 

you would then have the ability to set the attributes for each of the 2gether products on that form.

 

because we now have changed the name of the values from simple "id" to "idPRODUCTS_ID"

we also need to alter the handling in application_top from so it recognized those parameters.

in the case section case 'add_product' you change:

 

$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

 

 

to:

 

$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id'.$_POST['products_id']]))+1, $_POST['id'.$_POST['products_id']]);

 

 

and from :

 

$cart->add_cart($_POST['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($_POST['buy_tinn_add'], $_POST['id']))+1, $_POST['id']);

 

to:

 

$cart->add_cart($_POST['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($_POST['buy_tinn_add'], $_POST['id'.$_POST['buy_tinn_add']]))+1, $_POST['id'.$_POST['buy_tinn_add']]);


Treasurer MFC

Share this post


Link to post
Share on other sites
well, you would have to add the attributes to the 2gether form.

but because you would now have possibly 2 sets of attributes on there (2 dropdown boxes) you need to alter there names so they are unique.

I personally would remove the attibutes code from the product info page and put it in an includes file called products_attributes.php file which you then include in product_info.php. That way you can include the attributes anywhere in a simple way.

 

You would then also include it 2 times in the 2gether discount module, 1x for each product.

That includes file would have to take a variable because the product you wish to display the attributes for are different from the displayed product. In other words, you first set a check_id which is the products id you want the attributes for. If you do not, the includes file simply uses the products_id from the GET array as usual.

 

so the includes file products_attributes.php looks like this:

 

<?php

ob_start();

if ($check_id == '') {

$check_id = $HTTP_GET_VARS['products_id'];

}

 

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$check_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

?>

<table border="0" cellpadding="1">

<?php

$products_options_name_query = tep_db_query("select distinct popt.products_options_id,

popt.products_options_name

from " . TABLE_PRODUCTS_OPTIONS . " popt,

" . TABLE_PRODUCTS_ATTRIBUTES . " patrib

where patrib.products_id='" . (int)$check_id . "'

and patrib.options_id = popt.products_options_id

and popt.language_id = '" . (int)$languages_id . "'

order by popt.products_options_name");

 

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$products_options_array = array();

$products_options_query = tep_db_query("select pov.products_options_values_id,

pov.products_options_values_name,

pa.options_values_price,

pa.price_prefix

from " . TABLE_PRODUCTS_ATTRIBUTES . " pa,

" . TABLE_PRODUCTS_OPTIONS_VALUES . " pov

where pa.products_id = '" . (int)$check_id . "'

and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "'

and pa.options_values_id = pov.products_options_values_id

and pov.language_id = '" . (int)$languages_id . "'

order by pov.products_options_values_name");

 

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

if (isset($cart->contents[$check_id]['attributes'][$products_options_name['products_options_id']])) {

$selected_attribute = $cart->contents[$check_id]['attributes'][$products_options_name['products_options_id']];

} else {

$selected_attribute = false;

}

?>

<tr>

<td nowrap><?php echo $products_options_name['products_options_name'] . '</td><td>'. tep_draw_pull_down_menu('id'.$check_id.'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute,' style="vertical-align:middle" class="inputbox" '); ?></td>

</tr>

<?php

}

?>

</table>

<?php

}

$attributes_string = ob_get_clean();

?>

 

the include code on the standard product info page which would replace the normal attributes code looks like this:

 

include(DIR_WS_INCLUDES . 'product_attributes.php');

echo $attributes_string;

the include code for the 2gether discount display module looks like this:

 

for the first product:

 

$check_id = $product_a['products_id'];

include(DIR_WS_INCLUDES . 'product_attributes.php');

if ($attributes_string != '') echo '<br>'.$attributes_string;

and for the second product:

 

$check_id = $product_b['products_id'];

include(DIR_WS_INCLUDES . 'product_attributes.php');

if ($attributes_string != '') echo '<br>'.$attributes_string;

 

you would then have the ability to set the attributes for each of the 2gether products on that form.

 

because we now have changed the name of the values from simple "id" to "idPRODUCTS_ID"

we also need to alter the handling in application_top from so it recognized those parameters.

in the case section case 'add_product' you change:

 

$cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

to:

 

$cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id'.$_POST['products_id']]))+1, $_POST['id'.$_POST['products_id']]);

and from :

 

$cart->add_cart($_POST['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($_POST['buy_tinn_add'], $_POST['id']))+1, $_POST['id']);

 

to:

 

$cart->add_cart($_POST['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($_POST['buy_tinn_add'], $_POST['id'.$_POST['buy_tinn_add']]))+1, $_POST['id'.$_POST['buy_tinn_add']]);

 

Amanda,

 

This code is awesome. I also changed the add_cart function calls in includes/classes/shopping_cart.php to include the "true" paramter. This allows the buy-2gether items to show up as bought together in the cart. If the true is not included, the items do not show up as a buy-2gether special when added to the cart by the buy-together link. I added tep_ to the get_prid function call in the revised in_cart function.

 

The download links still do not show up. If I don't use the "true" in the shopping cart class, the download links show up, but the items don't show up as 2-gether.

 

Any ideas? We're almost there... :)

Share this post


Link to post
Share on other sites
Amanda,

 

This code is awesome. I also changed the add_cart function calls in includes/classes/shopping_cart.php to include the "true" paramter. This allows the buy-2gether items to show up as bought together in the cart. If the true is not included, the items do not show up as a buy-2gether special when added to the cart by the buy-together link. I added tep_ to the get_prid function call in the revised in_cart function.

 

The download links still do not show up. If I don't use the "true" in the shopping cart class, the download links show up, but the items don't show up as 2-gether.

 

Any ideas? We're almost there... :)

 

What I notice is that the attributes aren't getting passed if the add_cart_clean function is being called...

In other words, I add the true parameter to the shopping cart class and this makes the clean function get called, which, if I hover over the items in the cart at shopping_cart.php, they do not contain the attributes.

Share this post


Link to post
Share on other sites
What I notice is that the attributes aren't getting passed if the add_cart_clean function is being called...

In other words, I add the true parameter to the shopping cart class and this makes the clean function get called, which, if I hover over the items in the cart at shopping_cart.php, they do not contain the attributes.

 

I have also modified the clean function changing the product_id to comb_id. Either way has no effect.

 

Something is preventing the uprid from passing to the shopping cart page...

 

I'm sure the osC/php expert that you are will have some insight.

 

Your help is very valuable. Thank you so much.

Share this post


Link to post
Share on other sites
What I notice is that the attributes aren't getting passed if the add_cart_clean function is being called...

In other words, I add the true parameter to the shopping cart class and this makes the clean function get called, which, if I hover over the items in the cart at shopping_cart.php, they do not contain the attributes.

 

I am not sure what you mean exactly, the is no add_cart_clean function.

 

the code for the shopping cart would look like this:

 

$together_offer = false;

$together_this_done = false;

$together_recommend = false;

$together_products_query = tep_db_query("select product_1_id, product_2_id, discount, type from " . TABLE_2GETHER . " where status = 1 ");

while ($together_products = tep_db_fetch_array($together_products_query)) {

if ($together_products['product_1_id'] == tep_get_prid($products[$i]['id'])) {

if (!$cart->in_cart($together_products['product_2_id'],true)) {

$together_pid = $together_products['product_2_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

}

elseif ($together_products['product_2_id'] == tep_get_prid($products[$i]['id'])) {

if (!$cart->in_cart($together_products['product_1_id'],true)) {

$together_pid = $together_products['product_1_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

}

}

 

 

and make sure that the attributes you want to put on the 2gether form are indeed included inside the form tags.


Treasurer MFC

Share this post


Link to post
Share on other sites
I am not sure what you mean exactly, the is no add_cart_clean function.

 

the code for the shopping cart would look like this:

 

$together_offer = false;

$together_this_done = false;

$together_recommend = false;

$together_products_query = tep_db_query("select product_1_id, product_2_id, discount, type from " . TABLE_2GETHER . " where status = 1 ");

while ($together_products = tep_db_fetch_array($together_products_query)) {

if ($together_products['product_1_id'] == tep_get_prid($products[$i]['id'])) {

if (!$cart->in_cart($together_products['product_2_id'],true)) {

$together_pid = $together_products['product_2_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

}

elseif ($together_products['product_2_id'] == tep_get_prid($products[$i]['id'])) {

if (!$cart->in_cart($together_products['product_1_id'],true)) {

$together_pid = $together_products['product_1_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

}

}

and make sure that the attributes you want to put on the 2gether form are indeed included inside the form tags.

 

A typo - I meant in_cart_clean.

 

I pasted this code and got a parse error, so I'll look at it later, unless you happen to have some idea now that I corrected my error. The in_cart_clean is a function you wrote for me in an earlier post.

Share this post


Link to post
Share on other sites
A typo - I meant in_cart_clean.

 

I pasted this code and got a parse error, so I'll look at it later, unless you happen to have some idea now that I corrected my error. The in_cart_clean is a function you wrote for me in an earlier post.

 

well, if you get a parse error or any error for that matter, please state what the error says or it becomes a mere speculation effort on my part.


Treasurer MFC

Share this post


Link to post
Share on other sites
well, if you get a parse error or any error for that matter, please state what the error says or it becomes a mere speculation effort on my part.

 

I fixed the parse error. The changed product ids to include the attributes are not coming through when I hit the buy-2gether button, and the attributes are within the form tags.

Share this post


Link to post
Share on other sites
I fixed the parse error. The changed product ids to include the attributes are not coming through when I hit the buy-2gether button, and the attributes are within the form tags.

 

Now that I put the attributes in the 2gether form tags, the cart shows each item with a 2gether Special option. In other words, it thinks only one of the two items is in the cart.

Share this post


Link to post
Share on other sites
Now that I put the attributes in the 2gether form tags, the cart shows each item with a 2gether Special option. In other words, it thinks only one of the two items is in the cart.

 

Now I fixed that... The attributes pass, and it recognizes both items in the cart. However, on checkout_payment.php, the discuont does not show up.

Share this post


Link to post
Share on other sites
Now I fixed that... The attributes pass, and it recognizes both items in the cart. However, on checkout_payment.php, the discuont does not show up.

 

I added the True to the two 'in_cart's in ot_together.php.

 

Where else do I need to change it so that the correct uprid can get passed to the calculate_2gether_discount() function?

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

×