Yeah I think this would be usefulReneH4 wrote: ↑Mon Aug 02, 2021 4:55 pm And since I have a new template file, it was time to tweak it a bit more.
It now shows a STOCK-info line of text below the products name. I like this better that the BIG green V or BIG red X :-)
It was a simple tweak, but if anyone wants the code I can provide it.
shoppingcart.php price change on the fly
-
LeeFoster
- Contributor
- Posts: 263
- Joined: Sun Feb 28, 2021 9:41 pm
- Phoenix Version: v1.0.8.20
- Has thanked: 1 time
- Been thanked: 5 times
Re: shoppingcart.php price change on the fly
- ReneH4
- Contributor
- Posts: 145
- Joined: Mon Oct 26, 2020 12:00 pm
- Phoenix Version:
- Has thanked: 13 times
- Been thanked: 17 times
Re: shoppingcart.php price change on the fly
Lee, this is the new tpl file, I have included some comments. You also have to add two lines to you appropriate language file:
Code: Select all
<div class="col-sm-<?php echo $content_width ?> cm-sc-product-listing">
<?php
echo tep_draw_form('cart_quantity', tep_href_link('shopping_cart.php', 'action=update_product')) . PHP_EOL;
echo $products_field . PHP_EOL;
?>
<div class="table-responsive">
<table class="table mb-0">
<thead class="thead-light">
<tr>
<th class="d-none d-md-table-cell"> </th>
<th><?php echo MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRODUCT; ?></th>
<!-- next line commented out to remove heading stock column -->
<!-- <th><?php echo MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_AVAILABILITY; ?></th> -->
<th><?php echo MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_QUANTITY; ?></th>
<th class="text-right"><?php echo MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRICE; ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($products as $product) {
echo '<tr>';
echo '<td class="d-none d-md-table-cell"><a href="' . tep_href_link('product_info.php', 'products_id=' . $product['id']) . '">' . tep_image('images/' . $product['image'], htmlspecialchars($product['name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>';
echo '<th><a href="' . tep_href_link('product_info.php', 'products_id=' . $product['id']) . '">' . $product['name'] . '</a>';
foreach (($product['attributes'] ?? []) as $option => $value) {
echo '<small><br><i> - ' . $product[$option]['products_options_name'] . ' ' . $product[$option]['products_options_values_name'] . '</i></small>';
}
// BEGIN NEW_out_of_stock_notification
if (STOCK_CHECK == 'true' && tep_check_stock($product['id'], $product['quantity'])) {
$GLOBALS['any_out_of_stock'] = true;
echo '<span class="text-danger"><br><i><small>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_OUT_OF_STOCK_STOCK_RVM . '</i></small></span>';
} else {
echo '<span class="text-success"><br><i><small>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK_RVM . '</i></small></span>';
}
// END NEW_out_of_stock_notification
echo '</th>';
// BEGIN These_lines_are_deleted
// if (STOCK_CHECK == 'true' && tep_check_stock($product['id'], $product['quantity'])) {
// $GLOBALS['any_out_of_stock'] = true;
//
// echo '<td><span class="text-danger"><b>' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</b></span></td>';
// } else {
// echo '<td>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
// }
// END These_lines_are_deleted
echo '<td>';
echo '<div class="input-group">';
echo tep_draw_input_field('cart_quantity[]', $product['quantity'], 'style="width: 65px;" min="0"', 'number');
echo tep_draw_hidden_field('products_id[]', $product['id']);
// BEGIN These_lines_are_deleted
// echo '<div class="input-group-append">' . tep_draw_button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_UPDATE, null, NULL, NULL, NULL, 'btn-info') . '</div>';
// echo '<div class="input-group-append">' . tep_draw_button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_REMOVE, null, tep_href_link('shopping_cart.php', 'products_id=' . $product['id'] . '&action=remove_product'), NULL, NULL, 'btn-danger') . '</div>';
// END These_lines_are_deleted
echo '</div>';
echo '</td>';
echo '<td class="text-right">' . $GLOBALS['currencies']->display_price($product['final_price'], tep_get_tax_rate($product['tax_class_id']), $product['quantity']) . '</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</form>
<hr class="mt-0">
</div>
<?php
/*
$Id$
Copyright (c) 2016:
Dan Cole - @Dan Cole
James Keebaugh - @kymation
Lambros - @Tsimi
Rainer Schmied - @raiwa
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
?>