Jump to content

bsmither

Member
  • Posts

    16,876
  • Joined

  • Last visited

  • Days Won

    558

Everything posted by bsmither

  1. We can use a Code Snippet for this. In admin, Manage Hooks, Code Snippets tab, click Add Snippet. At the bottom of the list of existing snippets will be a form: Enabled: checked Unique ID: [email protected]+ Execution Order: 99 Description: Populates a custom template with most recently sold items. Trigger: class.gui.display Version: 1.0 Author: https://forums.cubecart.com/topic/57577-last-items-sold/ PHP Code: <?php function __displayRecentlySoldProducts($count) { if (!$GLOBALS['smarty']->templateExists('templates/box.recent.php')) { return false; } if (($recentProductsSold = $GLOBALS['db']->select('CubeCart_order_inventory', array('DISTINCT'=>'product_id','product_code','name'), array('product_id' => ">0"), array('id' => "DESC"), $count, false, false)) !== false) { $vars = array(); $GLOBALS['language']->addStrings(array('catalogue' => array('title_recent' => "Recently Sold"))); // Need to manually assign the newly modified language array to Smarty's LANG variable $GLOBALS['language']->assignLang(); foreach ($recentProductsSold as $recent) { $recent['url'] = $GLOBALS['seo']->buildURL('prod', $recent['product_id'], '&', false); $vars[] = $recent; } $GLOBALS['smarty']->assign('RECENT', $vars); $content = $GLOBALS['smarty']->fetch('templates/box.popular.php'); $GLOBALS['smarty']->assign('RECENTLY_SOLD_PRODUCTS', $content); } } __displayRecentlySoldProducts(5); // Show 5 recently sold items. Save the snippet. Now, there needs to be a template file to show the products. We will basically copy the Best Sellers (Popular Products) template. In the Foundation skin template directory, create a new file with the name: box.recent.php Have as its contents: {* * CubeCart v6 * ======================================== * CubeCart is a registered trade mark of CubeCart Limited * Copyright CubeCart Limited 2017. All rights reserved. * UK Private Limited Company No. 5323904 * ======================================== * Web: http://www.cubecart.com * Email: [email protected] * License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html *} {if $RECENT} <div class="panel" id="box-recent"> <h3>{$LANG.catalogue.title_recent}</h3> <ol> {foreach from=$RECENT item=product} <li><a href="{$product.url}" title="{$product.name}">{$product.name}</a></li> {/foreach} </ol> </div> {/if} Finally, there needs to be an edit that places this box on the main page. In the existing template: main.php Find: {include file='templates/box.featured.php'} {include file='templates/box.popular.php'} Add after (or before, or in-between) {include file='templates/box.recent.php'}
  2. The key 'helpful' and the phrase "Helpful" was meant as a general example. Add as many key/phrases as you want, replicating the relevant statements, directly in the snippet code (there is no admin panel available to do this): 'flat' "Crushed" 'boom' "Fully Exploded" 'niub' "New in Unopened Box" 'minripd' "Slightly Torn"
  3. In a stock install of CC6, the list of images to play in the slider is part of the HomePage document. In admin, Documents, click the Edit icon of the document shown as having the HomePage button selected. You may have an easier time of it by using the editor's Source mode. The slider is optimized to show 1000x300 pixel images.
  4. I just don't know if should, would, or could.
  5. The code suggests that CubeCart will send an email informing the customer that the order was "cancelled", the databased order summary gets updated to show that the order is now in a "cancelled" state, an entry is logged in the general order history log, and an entry is logged in the general order transaction log. CubeCart will also restore stock levels. This assumes that the payment agency (e.g., PayPal) has the necessary info of where and what to send to the store. I do not know how, if at all possible, if, when cancelling an order in CubeCart's admin, CubeCart uses the PayPal gateway to inform PayPal to initiate a refund. Nor do I know if, when initiating a refund action at the merchant's PayPal account control panel, if PayPal has, or even asks for, the needed info to "call" the store to instruct the store to effect a "PAYMENT.CAPTURE.REFUNDED" action.
  6. If you are authorized to remake the logo so that it fits about 560x120 pixels, then in admin, Store Settings, Logos tab, you can upload and designate that specific image to the Scope of just the Kurouto. If the logo must remain the same size, then there will be some adjustments needed to the height settings of the #header CSS rule and the background gradient images that paints the store. (I think, perhaps, that CSS3 offers CSS rules that paints gradients - dismissing the need for background images.)
  7. I will have to go back and see how you solved the "honor stock levels for digital products" situation.
  8. Here's an idea: instead of adding the new line of code after the existing code listed, add the new line before the existing code. This puts the new line of code within an if-block that only appears if the product is able to be sold. (It's redundant to say "Out of Stock" and "0 available" together.)
  9. A digital product? Well, if I recall your situation, even this digital product has been configured to limit the sales of "tickets to this limited-seating event". Earlier, there was this disclaimer: "This shows the main stock level. Products that have distinct stock levels assigned to specific option combinations, where the main stock level is set to zero, will show zero." This implies that if all the product's options are zero, CubeCart considers the product sold out, regardless what the main stock level is at. For this product, are there any options? I see no reason for there to be any options, and the February 19 product is sold out (doesn't show options, if any). In admin, Store Settings, Stock tab, what is the setting for "Main stock level as matrix stock level summary".
  10. For the moment, make an edit in the file /setup/setup.install.php: From: $errors[] = $strings['setup']['error_db_incorrect_something'].' '.$e->message; To: $errors[] = $strings['setup']['error_db_incorrect_something'].' '.$e->getMessage(); and try again. Make sure you have a database where you think it is, and that there is a user with permissions to create tables in an existing database. I believe a correct installation of the stack should have done this for you.
  11. From the screen shots above, I see what looks like a CubeCart set of files and folders in your hosting 'home' folder -- which also contains the /public_html/ folder. The web server is almost always configured to look in the /public_html/ folder for the files to serve when responding to requests to your web site. So, I conclude that CC650 was FTP'd into your 'home' folder when it should have been FTP'd into the /public_html/ folder, instructing the FTP to overwrite any and all existing files. (Make a backup first.)
  12. Please give this a test. In the Foundation skin template content.category.php, near the end, find: <a href="{$current}{http_build_query($params)}{$anchor}" data-next-page="{$params[$var_name]}" data-cat="{$category.cat_id}" class="button tiny expand ccScroll-next">{$LANG.common.more} <svg class="icon"><use xlink:href="#icon-angle-down"></use></svg></a> Change to: Showing <span id="products_showing">{$products_showing} of </span>{$TOTAL_RESULTS} products<a href="{$current}{http_build_query($params)}{$anchor}" data-next-page="{$params[$var_name]}" data-cat="{$category.cat_id}" class="button tiny expand ccScroll-next">{$LANG.common.more} <svg class="icon"><use xlink:href="#icon-angle-down"></use></svg></a> In the Foundation's skin javascript file 2.cubecart.js, find near the middle of the file: complete: function(returned) { var page = returned.responseText; var list = $('.product_list li', page); var next = $('a.ccScroll-next', page); $('.product_list li').removeClass("newTop"); $(list[0]).addClass('newTop'); setTimeout(function(){ product_list.append(list); set_product_view(0) $(next_link).replaceWith(next); init_add_to_basket(); Change to: complete: function(returned) { var page = returned.responseText; var list = $('.product_list li', page); var next = $('a.ccScroll-next', page); var products_showing = $('#products_showing', page).text(); $('.product_list li').removeClass("newTop"); $(list[0]).addClass('newTop'); setTimeout(function(){ product_list.append(list); set_product_view(0) $(next_link).replaceWith(next); if(products_showing){$('#products_showing').text(products_showing + " of ");}else{$('#products_showing').text("");} init_add_to_basket(); In the file /classes/db/databse.class.php, in the public function pagination(), near the end of the function, find: 'view_all' => (bool)$view_all, 'per_page' => (int)$per_page, Change to: 'view_all' => (bool)$view_all, 'per_page' => (int)$per_page, 'products_showing' => $page * (int)$per_page, Because the javascript file has been changed, you will need to force your browser to fetch a fresh copy of it. This is usually done with CTRL-F5.
  13. In the image several posts above, I see "Test (After Save)". Since CC650 is branched off of CC644, and CC644 does not say this (CC644 simply says "Test"), I am thinking your "upgrade" resulted in two or more folders, each starting with admin. Please verify if you have more than one folder starting with the letters "admin". If there are more than one, determine which folder has the latest date when viewing Cubecart's main directory listing. There is a file with the name /includes/global.inc.php that has a reference to the name of the administration folder that CubeCart will be using. It probably is using "admin_RHhCnM" - a folder that belongs to an older version of CubeCart. This reference must use the folder that belongs to CC650 -- probably having a date more recent than any other.
  14. The deprecated message won't stop the sending. Please view in admin, Error Log, System Error Log tab, for any clues.
  15. No Email Log in the left-side panel Admin Navigation menu?
  16. Hm... Try: {($product.quantity * $product.cost_price)|string_format:"%01.2f"} If that doesn't work (blank page), try: {$total_item_cost=$product.quantity * $product.cost_price}{$total_item_cost|string_format:"%01.2f"}
  17. Looking at the USPS module's shipping.class.php file, near lines 107: if(preg_match('/^([0-9]){5}-([0-9]){4}$/',$delivery['postcode'])) { $delivery['postcode'] = substr($delivery['postcode'],0,5); } If the string has a dash between the 5 and 4 count numbers, then use only the first 5 numbers. We can try to modify this as follows: From: '/^([0-9]){5}-([0-9]){4}$/' To: '/^([0-9]){5}-?([0-9]){4}$/' By putting a question mark after the dash, the test becomes "..., followed by a dash that may or may not be there,...". However, suppose the customer uses a space instead of a dash? One would think a US resident would know to use a dash and nothing but a single dash, if wanting to include the extension.
  18. This is one of my disagreements with CubeCart - not that I expect CC to be my main bookkeeping app. The cost of a widget may vary being influenced by any of several factors for each instance of acquisition: bulk buys, the price that day, the price set by a given supplier, the cost of acquisition, and others. So, a gadget that bottom-line cost $10 from supplier #1 in Canada on Monday, may have a bottom-line cost of $12 from supplier #2 in Mexico on Friday. CubeCart can't keep track of that. Even so, the data item 'quantity' and the 'cost_price' in the CubeCart_order_inventory are available. Create a column in the template's table and use the Smarty code: {$product.quantity * $product.cost_price} Smarty can do moderately complicated math stuff.
  19. CubeCart does a good job of figuring out where it is, but only so far as what it is told. If the web server has a vhost config file that does not discriminate on the sub-domain, or there are two or more vhost config files that point to the same installation, then CubeCart will use whatever the web server says. So: example.com www.example.com tre.example.com cc6.example.com ftp.example.com anything.example.com CubeCart will respond to any and all of them. It is up to the web server's vhosts config files to discriminate on the sub-domain. However, once CubeCart runs through its steps to deliver a page, with an empty cache, some parts are then cached complete with that last used domain -- ftp.example.com, in your case. Still, the steps when CubeCart is working through completing an order, having been given the domain, will continue to use it for all the pages delivered. Clear CubeCart's cache, and have the hosting provider assist you with getting the web server's vhosts files to answer to only www.
  20. Then I would recommend you continue this pattern: Use these statements; if ( empty($product['excel_name']) ) { $product_excel_name_record = $GLOBALS['db']->select('CubeCart_inventory','excel_name',array('product_id' => $product['product_id'])); $product['excel_name'] = $product_excel_name_record[0]['excel_name']; } To make new statements (a copy of the above with the desired target data): if ( empty($product['est_ship_box']) ) { $product_est_ship_box_record = $GLOBALS['db']->select('CubeCart_inventory','est_ship_box',array('product_id' => $product['product_id'])); $product['est_ship_box'] = $product_est_ship_box_record[0]['est_ship_box']; }
  21. The programmer's of CubeCart have the code available at the Github. You can fork it to your own repository and manage your customizations with it. Then, when ready and have permission, issue a Pull Request to the main repository. I, myself, use Subversion on an in-house server.
  22. The Foundation skin (and most, if not all, skins derived from it) already has GA code in it. The visitor must first accept the use of cookies.
  23. Ok, I had assumed you solved the task of transferring the new data items (excel_name, line, est_ship_box, etc) from CubeCart_inventory to CubeCart_order_inventory. "The info was not populated in the order" All of the data? (The product_code, product_id, and name are the only directly transferred data in stock code of Cubecart.)
  24. The table CubeCart_inventory is on a per-product basis. The table CubeCart_order_summary is on a per-order basis. The items sold in any given order is in CubeCart_order_inventory. So, which of several product's box data gets logged in the order's summary? The product's box data could be stored with the sold product record. This line of code (in 2. Order Special Data Tab), broken apart for readability: <div class="bg-white"> <label for="est_ship_box"><strong> Estimated Shipping Box:</strong></label> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span>{$PRODUCT.est_ship_box}</span> </div> The variable $PRODUCTS is an array of product data, as seen in the {foreach} loop. The variable $PRODUCT does not exist. I think you may need to rethink how your products get shipped. Does each item get shipped in its own box? If so, then the product's box data would be best stored with the product data in CubeCart_order_inventory. Do items that could conceivably be shipped with any other item not have any box data supplied? Is the Order Special Data tab built to accept any new data? Or display only? If display only, then use $product.est_ship_box (where $product is one element of the group of Item's Sold for the order) and put the line within the {foreach} loop.
×
×
  • Create New...