Jump to content
Sign in to follow this  
bws

Display all items in a category. Updated word in foreign language being ignored, cubecart using the older one..

Recommended Posts

 

This is not a major problem but I would like to fix it.
I downloaded a foreign language and was aware of a small error in the file, as I had downloaded the language before in a previous version.
But before correcting it I decided to first test out in the latest version 6.2.1 and see if I could check out both in the foreign language and in English.
That was successful, and when I received the confirmation email of my purchase, I was reminded to correct the error, because the Order Confirmation
said "Order COnfirmation" and that's the extent of the error. So I went back to language/email_ru-RU.xml and made the correction on
line 45, changed the large O to small o.

I placed another sample order and received another Order COnfirmation with a large O!
Waited a day, then went back to the file to make sure it was changed, and tried again. Another large O confirmed my order.

After that I went to the cache folder, didn't see anything there that looked like email or RU, it was all files from yesterday or today. I hit the clear
cache button and checked again, now there were only 8 files, each with current time, but no email or RU files.

I went to admin maintenance and cleared the language cache and regular cache again. Still no change in emails.

I did not clear the SQL cache at that time as I'm not sure what that would do.

Then I went to check the database, the table email content had this line in it:

(16, 'cart.order_confirmation', 'ru-RU', 'ПОдтверждение заказа #{$DATA.cart_order_id}',  etc..

And the lines above it are in 'en-GB' for example

(4, 'cart.order_confirmation', 'en-GB', 'Order Confirmation #{$DATA.cart_order_id}',

The lines below the 'ru-RU' ones are in 'en-US'


So that looks like the cause. Would clearing the SQL cache update line 16 to current? If not, how can I manually change the database?
Only need to change one letter to lower case.

About the GB English, it works okay but currenty using US English and GB is not switched on any longer so may be a good idea to make these other entries
US English.

 

Another item I would like to modify is one of my categories view. I have one category with about 20 items in it, and I would like all 20 items to show,
not just 12 items, plus a tiny More at the bottom.

The url for that is shop/1-ounce-silver-rounds.html. When the More is pressed, the link is
shop/1-ounce-silver-rounds.html?page=2 and url is shop/1-ounce-silver-rounds.html#2.  The latter links show not only the 2nd page, but all 20 items,
which is just what I want to display. Any way I can modify this one overstocked category to display all the items as a default when selected?

Regarding a cache issue earlier about the cookie notice, I figured out it was not cubecart cache causing the problems but browser cache. I solved that one
on a windows computer by going to gear -> internet options -> browsing history -> settings -> check for newer versions of stored pages -> select -> Every time
I visit the webpage. After that all changes made in cubecart actually changed up front.

 

Share this post


Link to post
Share on other sites

Posted (edited)

If this is content in an email template, then in admin, Email Templates, click the Russian flag for Cart: Order Confirmed. Edit the Subject text entry field and click Save.

CubeCart does not cache email language files (email_ru-RU.xml), but rather databases them immediately after having first discovered their presence.

Changes made in this admin screen will update the databased contents.

 

Edited by bsmither

Share this post


Link to post
Share on other sites

I didn't even know about the Email Tempate button..  I should check all those buttons out when I have more time!  Well it works.

I see I have some errors in my system log, two of them I know how to solve, I need to upload the extension_info table to my test db from version 6.1.13, and also the cookie_consent , but there are two I don't understand.. They came up just now after I did the sample order..  Everything seems to work okay despite the errors but would like to not have any!

 

Today, 17:43 File: [orders.transactions.inc.php] Line: [79] "SELECT SQL_CALC_FOUND_ROWS DISTINCT `T`.`order_id`, `T`.`time`, `T`.`amount`, `T`.`gateway`, `T`.`trans_id`, `S`.`id`, `S`.`custom_oid`, `S`.`cart_order_id` FROM `cctest_CubeCart_transactions` AS `T` INNER JOIN `cctest_CubeCart_order_summary` AS `S` ON `T`.`order_id` = `S`.`cart_order_id` LIMIT 20 OFFSET 0;" - Unknown column 'S.custom_oid' in 'field list'

 
Today, 17:14 File: [settings.index.inc.php] Line: [231] "SELECT SQL_CALC_FOUND_ROWS id FROM `cctest_CubeCart_order_summary` WHERE `custom_oid` <> '' LIMIT 1;" - Unknown column 'custom_oid' in 'where clause'

 

 

 

 

 
   

 

Share this post


Link to post
Share on other sites

I am going to say that when your codebase was upgraded to CC620+. the database schema did not get updated as well.

Please open the following files in a programmer's text editor, study the SQL statements contained therein, and execute any statement that may be required:

/setup/db/upgrade/, files: 6.1.14.sql, 6.1.15.sql, 6.2.0-b1.sql, 6.2.1, and 6.2.2.sql

There is also a script at /setup/scripts/upgrade/6.2.0-b1.php that will database a new email template.

Share this post


Link to post
Share on other sites

Let's try a code snippet to have CubeCart show all products of a category on one page if the number of products is 20 or fewer, even if the number of products per page is set otherwise.

In admin, Manage Hooks, Code Snippets tab, click Add Snippet.

Fill in the form as follows:

Enabled: Checked
Unique ID: override_page_per@cc600+
Execution Order: 99
Description: Shows all products on one page if count is X or less.
Trigger: class.catalogue.pre_search
Version: 1.0
Author: Forum Conversation
PHP Code:
<?php
/********************************
 * If any category has X amount
 * of products assigned, then
 * show all products even if the
 * skin config or store settings
 * have it set otherwise. The
 * number of products include
 * those that might not display.
 ********************************/

$all_on_one_page = 20;
if(is_numeric($search_data) && ($override_per_page = $GLOBALS['db']->select('CubeCart_category_index', array('id'), array('cat_id' => $search_data))) && count($override_per_page) <= $all_on_one_page) $page = "all";

Save the snippet.

Test.

 

Share this post


Link to post
Share on other sites

 

I tested the code. I could see it was trying to work because when I went to view a category I got this bit at the top of the page..

Enabled: Checked Unique ID: override_page_per@cc600+ Execution Order: 99 Description: Shows all products on one page if count is X or less.
Trigger: class.catalogue.pre_search Version: 1.0 Author: Forum Conversation PHP Code:

So I went back and removed that part. I changed the number to 24 to allow for some new products, but still only showed the 12. Then I decided to get an exact
count of how many products were in that category, 22 and changed the number to 22. Now it works perfectly. If I ever add more stock in that category then I
will just update the number.

Do you know if it's possible to remove the pricing from products, only after a search which displays multiple items? I have had a programmer add a nifty
calculator to my cubecart, but have not been able to contact him so I'm on my own with upgrading the calculator into version 6.2.1. He provided some good
documentation of his work, and I've been trying to upgrade the calc into the latest version of cubecart, at the time was v6.1.13 but could not get everything
to work properly. I decided to start fresh with cubecart v6.2.1 and took the time to not use the older pages, but only the actual changes into the current
v6.2.1 pages, and finally I have got it to work. Although I'm getting a few error messages, probably they are unrelated to the calc mod. V6.2.1 works fine now
with the calculator.

Anyway there is one bug in the calc program which was in the original program he did, and I did not have enough time to notify him because I didn't notice it
until some time after the work was done. We have an extra table in the db for material, and I set the material, for instance silver, at the current market price
periodically. The db knows which product is associated with which material and cubecart does a calculation to arrive at item price = material price * item weight
in ozs + the normal cubecart price which is actually the premium representing manufacturing and other costs + profit. So with silver set at $16 and $5 premium,
the cost shows as $21 in catalog and thru checkout.

The minor bug which I would like to solve is that if a search is done, it's fine if only one product is found because it goes to the product page and only
adds this colored box at the top - Just one product was found matching 'search item' - and price is calculated as usual.

But if several items show in the results, then what it does is displays the prices as only the premium price of $5! Of course when the item is clicked on,
the next page will show the full price, so no way a customer could buy at the $5 price. I've never even had any customers notice this or at least say anything
about it before. But I would like to figure out a way to correct it.

Either by causing the search results page to show no prices, or figure out how to get the calculator function to also work on that page. I think not showing the
price there might be the easiest way without the programmer's help.

Thanks a lot for the code snippet. That will really help when a customer views the overstocked category, to see all, not just half!

 

 

Share this post


Link to post
Share on other sites

"I got this bit at the top of the page" Enabled: Checked (etc)

That's not good. Something went horribly wrong. Those instructions are what the various form elements require. If these instructions are appearing on the store page exactly as I gave them above, then the form wasn't filled out correctly, or CubeCart is misbehaving very, very badly.

"So I went back and removed that part."

From where?

 

Share this post


Link to post
Share on other sites

I probably should have just pasted it in and pushed the button. But I saw the enable box so I ticked it, entered the 99 manually, etc.  I guess if you paste and push, it reads in that top bit and then deletes it. But since it was already filled in, it probably didn't delete it so I went back and deleted that bit myself, and the code now starts with the commented section. I'll try paste and push next time to test.

Update on category code snippet: I went to the front end of my store to check on how many items would display, and it didn't seem to be working. Then I
found another category that had even more items in it, so I went back to the code and increased the number to 32. After going back to the first category
I realized I had a lot more in there, more than the 22 items I had thought, as that was all I could see after I tapped the more button.. I actually have 44 items
in the category I thought had 22, so I increased the number again, to match 44 now visible, which appeared out of the blue.

Now both categories "show everything" and I have a nice #2 at the end of url in each..
I'm really glad I decided to fix this, because if I don't know how many items are in these categories, then I know the shopper/buyer isn't going to know..
My categories are no longer embarrassed to "show everything," so I hope shoppers appreciate that as much as I do.

Share this post


Link to post
Share on other sites

 

Update #2 on show all items in category code snippet.

Checking front end today category 1 Generic showing 22 out of 44 items on initial view, .html in browser and More at bottom. Clicking More shows all 44
items, with .html#2 in url.

Category 2 North American showing 16 out of 32 items on initial view, .html in browser and More at bottom. Clicking More shows all 32
items, with .html#2 in url. Going to other categories and returning to overstocked ones shows .html#2 remaining in url and all items displayed.

Even though not showing all items until More at bottom is clicked, this is working way better than before the modification code was installed,
and I'm giving it 5 stars.

 

 

Regarding my calculator mod, does anyone know how I can get it to calculate the full price after a search (/search.html)?

The calculator engine appears to be in shop/classes/catalogue.class.php

$product = $this->getProductPrice($product); was commented out and formula for calculating full price was added below that.


1) shop/classes/catalogue.class.php

1.1) Find
  $product = $this->getProductPrice($product);
and comment it out
  // //$product = $this->getProductPrice($product);

1.2) Find    
 foreach ($GLOBALS['hooks']->load('class.cubecart.product_price') as $hook) include $hook;
and add below
   if (($materials = $GLOBALS['db']->select('CubeCart_materials', array('price'), array('id' => (int)$product_data['material']))) !== false) {
    
    $surcharge=$product_data['product_weight']*$materials[0]['price'];
    
    if ($product_data['sale_price']) {
     $product_data['sale_price']+=$surcharge;
    }
    $product_data['material_price']=$surcharge;
    $product_data['price']=$product_data['price']+$surcharge;
    
    }
    


I'm not a programmer but it looks to me that there is another cubecart file associated with the search page, that needs to have price of product commented out
and formula added below that. What is the search file that I should start experimenting with?

I get the full price everywhere in the catalog and thru checkout, however after doing a search with multiple results, the "price" shows as only the price
(=premium) part of the formula and leaves out the material price * material weight part of the formula to be added giving a total.

 

Share this post


Link to post
Share on other sites

Try removing the comment symbol (//) from that statement, thus making it do it's thing.

If the calculator is in getProductPrice(), skipping over doing that ( // //$product = $this->getProductPrice($product); ) is the wrong approach.

Keep in mind that the Search page allows for filtering against a price range - which simply won't work correctly when the calculator is operating against the list of products found after the search is complete. (The search function is also used to find sale items and products in a specific category.)

 

 

Share this post


Link to post
Share on other sites

Good Afternoon

I'm building a new sitemap today and updating my new and improved seo with shorter links. I was going and copying each new link from the url of each product,
from the Generic category, and while I was doing this I realized more about what the code snippet was doing. I actually have only 22 items in that category as
I originally thought. These all show initially with the code snippet switched on. The part that's a little confusing is at the bottom the More button
also shows. So one would think there are more to show. After the button is pressed, 44 items appear! But the additional 22 are a repeat of the first 22!

As a seller I really don't care as a buyer could very well see something they like out of the 44 as easily as having 22 to look at.. But if you wanted to
polish this one up a bit, I would also have it remove the More button!


About changing the calculator code, well since my latest cubecart is now working with the calculator, I'm not going to change stuff there but I will go back
to another older version I have that's had the calculator engine installed and working, and has same issue with search results, and experiment over there with calc code changes first.

I will experiment with the older version sometime this weekend.

Thanks for your interest and expertise.

Share this post


Link to post
Share on other sites

My older version cubecart won't work to test the calc because it was never 100% functional. I went there and saw the full price in the store but during
checkout the total price displayed was only the "material price * material weight" part of the formula, the opposite of the search error which displays
only the premium-price part.

I'm going to get in contact with the server people and find out how to duplicate my latest version of cubecart folder and make another folder with .b
at the end. That way I can experiment with the identical cubecart while leaving the original online and safe. If the changes work out okay, then I can
move them over to original cubecart, or switch folders and put the modified folder online and use the other one for further modifications.

Share this post


Link to post
Share on other sites

After I talked with server people I found out Softaculous was automatically saving about 250 MB of files for me on a daily basis, for older versions I was about to delete. So I turned those off and will check back in a day or two and make sure it's stopped, then delete the 250 MB from softaculous_backups folder. While I was in Softaculous I saw some other icons and it looks like I can make an extra copy of installation there, so I will go back after I take care of deleting the unneeded backups.

I added the extension info table and cookie consent table to the db, because of the error messages I was getting in admin System Error Log, and those errors went away. Today I did a sample purchase from the store and checked the error log, 2 errors came up while I was checking out,

Today, 11:02 File: [settings.index.inc.php] Line: [231] "SELECT SQL_CALC_FOUND_ROWS id FROM `cctest_CubeCart_order_summary` WHERE `custom_oid` <> '' LIMIT 1;" - Unknown column 'custom_oid' in 'where clause'

Today, 11:01 File: [settings.index.inc.php] Line: [231] "SELECT SQL_CALC_FOUND_ROWS id FROM `cctest_CubeCart_order_summary` WHERE `custom_oid` <> '' LIMIT 1;" - Unknown column 'custom_oid' in 'where clause'


Does anyone know what's causing these and the remedy?

 

Share this post


Link to post
Share on other sites

Softaculous installed which version?

Please open the following files in a programmer's text editor, study the SQL statements contained therein, and execute any statement that may be required:

/setup/db/upgrade/, files: 6.2.0-b1.sql, 6.2.1, and 6.2.2.sql

6.2.0-b1 has:
ALTER TABLE `CubeCart_order_summary` ADD `custom_oid` VARCHAR(50) NOT NULL DEFAULT ''; #EOQ

6.2.1 has:
ALTER TABLE `CubeCart_order_summary` ADD INDEX (`custom_oid`); #EOQ

If Softaculous installed CC621, and the resulting database did not have the column 'custom_oid', then there is a fault that Softaculous should be made aware of.

Share this post


Link to post
Share on other sites

Softaculous installed the correct version, 6.2.1. But soon after it was installed, I continued the testing I was doing with a working modified 6.0.12  version, trying to pass the mods over to version 6.1.13.   I created a new db and then inserted a db I had been using into the new one, and tried to get it working with version 6.1.13. After a certain period of time I realized I was not going to get the calc mod to function properly there, and I decided to learn more about why most of my pictures were not appearing in the listings, only a few pictures were showing up. After finding some info online about this, it appeared that there were 3 tables involved -  inventory, image index, and filemanager. I started studying the index numbers in all these, comparing a product in that db with same product in the original version 6.0.12 where everything worked, including the pictures.

I never really figured out how it all worked, but I noticed that some numbers in file manager were different for same product in both versions. Since the original version was working just fine, I decided to take the file manager table from 6.0.12 and insert into version 6.1.13 after clearing the table.

I had nothing to lose since the half baked calc program wasn't going anywhere, nothing to lose if things didn't go right. After I did this, what a surprise, all the pictures showed up!  This modified db also gave me about 100 products, arranged in multiple categories and subcategories, and in two languages. Only the calc didn't work, and the db part of the calc did work. The link on the back end didn't show up, but I knew what the url was that the link would have generated, and when I pasted it into url in the back end, I was able to access the 2 materials prices and change prices.. 

After that success I decided to download the latest cubecart version which was about a year ahead of the one I was trying to modify.. I did receive the correct db with latest version, and as soon as I saw there was one test product and one test category, I decided to keep that db in a safe place and create a brand new db, after which I inserted a copy of the db from version 6.1.13. I then re-adjusted the global.inc file and Voila! All products all neatly arranged in their proper category. Test item and test category vanished!  I really didn't want to delete that one or manually add all my stuff..  So I was very pleased about it, and that's when I decided to get serious about getting the calc mod to work! I requested and received good documentation about all changes made by the programmer, I just had to go one step at a time, and try to make sense of it and what each part did to the program.

I re-documented everythng, and also have my own mods documented. After a month or two I succeeded in getting things to work exactly as they did in version 6.0.12, including the search error.

After your last post, and another before it regarding db schema, I realize what the problem is. The db schema gets changed periodically, and the one I have from version 6.1.13 is missing some tables the current version has, or some columns in some tables.. Today I went and found the original version 6.2.1 db that I kept in a safe place and copied the order summary table. Then I deleted the order summary table in the test db. Then I added the latest version order summary table into test db.

Now everything works fine when I checkout and no errors in error log!

Probably took care of the Mr T vs Superman error I received a few days ago too..  Contains the "custom_oid" in two places..

09 Aug 2018, 17:43 File: [orders.transactions.inc.php] Line: [79] "SELECT SQL_CALC_FOUND_ROWS DISTINCT `T`.`order_id`, `T`.`time`, `T`.`amount`, `T`.`gateway`, `T`.`trans_id`, `S`.`id`, `S`.`custom_oid`, `S`.`cart_order_id` FROM `cctest_CubeCart_transactions` AS `T` INNER JOIN `cctest_CubeCart_order_summary` AS `S` ON `T`.`order_id` = `S`.`cart_order_id` LIMIT 20 OFFSET 0;" - Unknown column 'S.custom_oid' in 'field list'

Taking a couple days off to celebrate, then will see about setting up a duplicate store to experiment on further, and see about getting the search page to work properly.

Share this post


Link to post
Share on other sites

Nothing wrong with experimenting.

The explosions can't be all that bad if you still have your eyebrows.

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
Sign in to follow this  

×