Skip to content

Commit

Permalink
[#590] - Product option Price doesn't get saved once logged in as cus…
Browse files Browse the repository at this point in the history
…tomer. Fixed checkout confirmation and checkout success option display.
  • Loading branch information
wa4u committed Jun 2, 2015
1 parent f927c86 commit c425ef6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 19 additions & 1 deletion catalog/includes/classes/shopping_cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,25 @@ public function synchronizeWithDatabase() {
if ( $new_price = $lC_Specials->getPrice($Qproducts->valueInt('products_id')) ) {
$price = $new_price;
}
}
}

// options modifiers
if (is_array($data['simple_options']) && count($data['simple_options']) > 0) {
$modTotal = 0;
foreach ($data['simple_options'] as $options_id => $values_id) {
$QsimpleOptions = $lC_Database->query("select * from :table_products_simple_options_values where customers_group_id = :customers_group_id and options_id = :options_id and values_id = :values_id and products_id = :products_id limit 1");
$QsimpleOptions->bindTable(':table_products_simple_options_values', TABLE_PRODUCTS_SIMPLE_OPTIONS_VALUES);
$QsimpleOptions->bindInt(':customers_group_id', '1');
$QsimpleOptions->bindInt(':products_id', $Qproducts->valueInt('products_id'));
$QsimpleOptions->bindInt(':options_id', $values_id['group_id']);
$QsimpleOptions->bindInt(':values_id', $values_id['value_id']);
$QsimpleOptions->setDebug(true);
$QsimpleOptions->execute();

$price = (float)$price + $QsimpleOptions->valueDecimal('price_modifier');
$QsimpleOptions->freeResult();
}
}

$this->_contents[$Qproducts->valueInt('item_id')] = array('item_id' => $Qproducts->valueInt('item_id'),
'id' => $Qproducts->valueInt('products_id'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
}
if ( $lC_ShoppingCart->hasSimpleOptions($products['item_id']) ) {
foreach ( $lC_ShoppingCart->getSimpleOptions($products['item_id']) as $option) {
if ($option['group_title'] != '') echo '<div class="small">- ' . $option['group_title'] . ': ' . $option['value_title'] . '</div>' . "\n";
$mod_price = (($option['price_modifier'] > 0) ? '+' . $option['price_modifier'] : (($option['price_modifier'] == 0) ? null : $option['price_modifier']));
if ($option['group_title'] != '') echo '<div class="small">- ' . $option['group_title'] . ': ' . $option['value_title'] . ' <em>' . $mod_price . '</em></div>' . "\n";
}
}
echo '</td>' . "\n";
Expand Down
3 changes: 2 additions & 1 deletion catalog/templates/core/content/checkout/checkout_success.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
}
if ( is_array($products['options']) && empty($products['options']) === false ) {
foreach ( $products['options'] as $key => $option) {
if ($option['group_title'] != '') echo '<div class="small">- ' . $option['group_title'] . ': ' . $option['value_title'] . '</div>' . "\n";
$mod_price = (($option['price_modifier'] > 0) ? '+' . $option['price_modifier'] : (($option['price_modifier'] == 0) ? null : $option['price_modifier']));
if ($option['group_title'] != '') echo '<div class="small">- ' . $option['group_title'] . ': ' . $option['value_title'] . ' <em>' . $mod_price . '</em></div>' . "\n";
}
}
echo '</td>' . "\n";
Expand Down

0 comments on commit c425ef6

Please sign in to comment.