Jump to content

bsmither

Member
  • Posts

    16,849
  • Joined

  • Last visited

  • Days Won

    556

Posts posted by bsmither

  1. I see nothing wrong with the code you posted above, as long as you also have:

    if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
    
    ''' all the code you posted above ...
    
            } // finishes - foreach ($_POST['product'] ...
        } // finishes - if (isset($_POST['product']) ...
        httpredir(currentPage());
    } // finishes - if (isset($_POST['status']) ...

    As you hinted, because you are also updating a number of other data items from the list, with some name changes to the <input> elements, the 'latest' data item can be grouped into the $_POST['product'] array.

  2. Try this:

    The skin's template content.category.php, find:
    
                <div class="product_pricing text-right clearfix">
                  {if $product.ctrl_sale}
                  <span class="old_price">{$product.price}</span> <span class="sale_price">{$product.sale_price}</span>
                  {else}
                  <div><span>{$product.price}</span></div>
                  {/if}
    
    Add immediately after:
    
    {if $product.available lte 0}
    <span>{$LANG.common.unavailable}</span>
    {elseif $product.ctrl_stock && !$CATALOGUE_MODE}
    <form action="{$VAL_SELF}" method="post">
    <span><input type="text" name="quantity" value="{$product.minimum_quantity|default:'1'}" maxlength="3" class="btn btn-success quantity text-center" style="width:3em;height:1.1em;">
    <button type="submit" value="{$LANG.catalogue.add_to_basket}" class="btn btn-success" style="height:1.1em;line-height:0">{$LANG.catalogue.add_to_basket}</button></span>
    <input type="hidden" name="add" value="{$product.product_id}">
    </form>
    {elseif !$CATALOGUE_MODE}
    <span>{$LANG.catalogue.out_of_stock_short}</span>
    {/if}

     

  3. As an experiment, I requested from your site the page:

    http://magazin.art86.org/images/general/cvv.gif
    and
    http://magazin.art86.org/js/common.html

    That was received. So, probably nothing wrong with the web server.

    I also requested:

    http://magazin.art86.org/docs/examples/code_snippet_import.php

    This was received. So, probably nothing wrong with executing PHP scripts.

    There is some work being done before Debug runs it's __construct() method. Perhaps the problem happens very early when starting CubeCart.

    Please follow these instructions and maybe the error will get logged to an error file:

    https://forums.cubecart.com/topic/51550-how-to-create-the-error-log/

    In the file ini.inc.php, near line 21, there is also a statement that allows or inhibits the display of errors to the screen. Suggest changing this to true.

  4. In the $thead_sort array of the admin script, please try:

    'product_latest' => $GLOBALS['db']->column_sort('latest', 'LP', 'sort', $current_page, $_GET['sort']),

    Then, in the <thead> block of the admin skin template, use:

     <th nowrap="nowrap">{$THEAD.product_latest}</th>

    In the corresponding slot in the group of <td> cells, use:

    <td align="center"><input type="hidden" name="latest[{$product.product_id}]" id="latest_{$product.product_id}" value="{$product.latest}" class="toggle"></td>

    Then, finally, back in the script, to process the checkboxes for being in the Latest Products group:

    Find:
    
    if (isset($_POST['status']) && is_array($_POST['status']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
        // Update Status
        foreach ($_POST['status'] as $product_id => $status) {
            $GLOBALS['db']->update('CubeCart_inventory', array('status' => $status), array('product_id' => $product_id));
        }
    
    Add after:
    
        if (isset($_POST['latest']) && is_array($_POST['latest']) && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) {
            // Update Latest Product state
            foreach ($_POST['latest'] as $product_id => $state) {
                $GLOBALS['db']->update('CubeCart_inventory', array('latest' => $state), array('product_id' => $product_id));
            }
        }

     

  5. So, the database table CubeCart_order_summary, for the order of interest, shows a non-zero value in 'shipping'.

    Then, I must question whether a "Free Shipping" coupon was applied to the order.

     

  6. Using a coupon that has the Free Shipping setting checked should show all shipping charges as zero - everywhere because that is what gets posted to the CubeCart_order_summary table, 'shipping' column.

    For the order of which you are observing this difficulty, please verify the value in CubeCart_order_summary, shipping.

     

  7. Attached is a report that covers the edits needed to make CC645 run under PHP 8.1.

    Of course, without a comprehensive testing procedure plan - preferably automated - hitting every feature and function that CubeCart can do is impractical. As such, I advise against running this in a production environment, for now.

    However, I believe I've found and fixed the Fatal Errors, Warnings, Deprecated Notices, as well as a number of general notices that became visible under PHP 8.1, and made a number of code optimizations, but only in the core code.

    I have chosen to not make a fork of CC645. For those who want to slog through the edits, I hope they will be able to discern the reasons for each change.

    Any module encoded with ionCube will need a new version from the publisher. The publisher should also take it upon themselves to test their modules under PHP 8.1.

    Some additional insights can be found reading the latest Github issues.

     

     

    PHP8.1_Changes.txt.zip

    • Thanks 1
  8. In admin, Manage Hooks, Code Snippets tab, click the Add Snippet link.

    The next page will include a form at the bottom of the list.

    Enabled: checked
    Unique ID: [email protected]+
    Execution Order: 99
    Description: Adds a custom social link to the list.
    Trigger: class.gui.display_social
    Version: 1.0
    Author: https://forums.cubecart.com/topic/57797-how-can-i-add-my-discord-to-the-footer-social-links/
    PHP Code:
    <?php
      $vars[] = array(
      'url'  => 'http://www.discord.com/user/', // Put the complete URL here
      'name' => 'Discord', // Put the name of the social media platform here
      'icon' => 'discord' // assuming it exists
      );

    Save the snippet.

    Here is a site that has Discord SVG icons.

    https://www.iconpacks.net/discord-icons.html

    We will need to figure out which icon to use, and how to add it to the skin's /images/icon-sprites.svg file.

  9. In the Foundation skin template 'content.homepage.php', near lines 43-45, find:

    Find:
                {* Remove comment if you want info button
                <a href="{$product.url}" title="{$product.name}" class="button tiny secondary left">{$LANG.common.info}</a>
                *}
    Change to:
                {* Showing info button *}
                <a href="{$product.url}" title="{$product.name}" class="button tiny secondary left">{$LANG.common.info}</a>
                {* *}

    But now the whole "Add to basket" needs to be suppressed.

    Line 46:
                {if $CTRL_HIDE_PRICES}
    Change to:
    {*          {if $CTRL_HIDE_PRICES}
    
    Lines 75-76, from:
                <input type="hidden" name="add" value="{$product.product_id}">
             </form>
    Change to:
                <input type="hidden" name="add" value="{$product.product_id}"> *}
             </form>
    
    Another necessary change, line 58, from:
                {* ctrl_stock True when a product is considered 'in stock' for purposes of allowing a purchase, either by actually being in stock or via certain settings *}
    Change to:
                <!-- ctrl_stock True when a product is considered 'in stock' for purposes of allowing a purchase, either by actually being in stock or via certain settings -->

    The Foundation skin template 'content.category.php' has two sections (list and grid views), and the grid view is similar to the Homepage layout.

    So, for the grid view, make the same edits at lines 163-165:

    From:
                   {* Uncomment this if you want to show a more info link
                   <a href="{$product.url}" title="{$product.name}" class="button tiny secondary left">{$LANG.common.info}</a>
                   *}
    Change to:
                   {* Showing a more info link *}
                   <a href="{$product.url}" title="{$product.name}" class="button tiny secondary left">{$LANG.common.info}</a>
                   {* *}
    
    Line 166, from:
                   {if $product.available <= 0}
    Change to:
    {*             {if $product.available <= 0}
    
    Lines 189-191, from:
                   {/if}
                </div>
             </form>
    To:
                   {/if} *}
                </div>
             </form>
    
    Another necessary change, line 172, from:
                   {* ctrl_stock True when a product is considered 'in stock' for purposes of allowing a purchase, either by actually being in stock or via certain settings *}
    Change to:
                   <!-- ctrl_stock True when a product is considered 'in stock' for purposes of allowing a purchase, either by actually being in stock or via certain settings -->

    For the Category's list view, there is no code provided for an Info button (but code can be added). This will just suppress the "Add to Basket" button. The image and product name serves as links to the product's Details page.

    Line 106, from:
                      {if $product.available <= 0}
    Change to:
    {*                {if $product.available <= 0}
    
    Lines 129-132, from:
                      {/if}
                   </div>
                </div>
                <div class="product_grid_view hide">
    Change to:
                      {/if} *}
                   </div>
                </div>
                <div class="product_grid_view hide">

    Additional tweaks may be necessary.

  10. For Mican, the template 'content.register.php':

    Near line 23, part of that line is:
    
    {if isset($DATA.mailing_list) && $DATA.mailing_list == 1}checked="checked"{/if}
    
    Change to:
    
    {if isset($DATA.mailing_list) && $DATA.mailing_list != 1}{else}checked="checked"{/if}

    As I read this change, once the registrant affirmatively unchecks the box, then for an occasion where the registrant is shown this same page to fix a fault, the checkbox should stay unchecked.

     

  11. The column 'popularity' is used to show 'views' of the product's details page.

    'Sales' is calculated by summing the quantity column from all the rows in CubeCart_order_inventory that are of the product.

     

  12. CubeCart's sanitizer logs the fact that it removed something, and also shows what was removed. But the entry into the log does not show where it was removed from: GET (the querystring seen in the access logs), POST (not visible in the access logs), or COOKIES (not visible).

    So, if the removed element was in POST or COOKIES, there will be no obvious matching log entry in the access logs for it. The only match will be date/time (add an offset of a few hours to get to UTC time).

    "Get these errors every day"? That's the wrong question. The question is, "Does having a successful online presence outweigh this 'annoyance'?"

  13. If/When you view the access logs, you may find a bot was trying a variety of known vectors into exploitable applications.

    In this case, the request seems to check for the existence of the Java AUGUR® Web Server - a specialty, extremely small web server that is (maybe, I don't know for sure) used for the web interfaces of routers and other "Internet of Things" (IoT) devices.

    The querystring (the part after index.php) contains a character that CubeCart deems suspicious (because CubeCart does nothing that would need this character). The Sanitizer killed it and logged a message.

  14. After analyzing the code, I find that a recent change in ini.inc.php will test for the version of PHP it is running under.

    The test will have PHP die with the message that CubeCart is not ready for PHP8+ and recommends that PHP7.4 be used.

    So, right from the start, a stock install of CC645 is a 'no-go' on PHP8+.

    But, I will defeat that kill switch, swap out Smarty 3 for Smarty 4, and see what happens under PHP 8.1.

     

×
×
  • Create New...