| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
How to change Add Date field for a Product | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
How to change Add Date field for a Product
Hello Guys,
As you may know in table [xcart_products] there is a field named [add_date]. This is a very powerful field for customization of XC (mark a product as new, newest products, ...). Its value you see it is in UNIX date format (e.g. 2147483647 = Tue, 19 Jan 2038 03:14:07 +0000). In the past many of you asked in this forum how to change this field in Admin -> Product page. Here is a solution for you free of charge checked and functioning in XC v4.5.0 (you can choose your new date with jQuery UI). By default for new products the date is set for today. Step 1 - Here are the files we have to change: - [XC-Dir]/include/product_modify.php - [XC-Dir]/skin/common_files/main/products_details.tpl product_modify.php Search for the following string: // Update product data. after: Code:
Code:
Search for the following string $query_data = array ( after: Code:
Code:
product_modify.tpl Search for the following string $lng.lbl_availability. After this html table row for product availability (the one with html select) paste the following code: Code:
Step 2 - New Label We have to add a new label in languages. I have called this label "lbl_add_date" with value "Add Date". You can also execute the following query with phpMyAdmin or inside XC interface PHP Code:
I have attached the files I modified v4.5.0. Please note to do a backup before replacement in their folders (rename your original files with extensions like .ph_ or .tp_). As improvement I could change the behavior to see the sticky container coming (Apply button) after altering a value. For this I should create a new template called datapicker_p.tpl and leave only an input html tag in product_modify.tpl. Sticky container comes only if input/check boxes tags exists in product_modify.tpl. You can do it by your own, I can live without it. Also "Mark a product as new" feature with a time configured in Appearance or just (Start - End) time in product modified page is a piece of cake based on this thread. Looking for volunteers. In my humble opinion this easy customization should be done years before and being standard in all XC versions.
__________________
X-Cart Next: Business 5.2 (learning and testing) X-Cart Classic: Gold and Gold Plus 4.7 Lots of Modules and Customizations OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions) You can catch my ideas here: http://ideas.x-cart.com |
|||||||||
#2
|
|||||||
|
|||||||
Re: How to change Add Date field for a Product
Hi ADDISON,
Thanks for a good code.Will it work on x-cart Pro 4.4.2? Thanks. |
|||||||
#3
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
I did not test it on a Pro 4.4.2. Make a backup of those two files so nothing wrong could happen if you alter the code.
Normally it should work on all versions since 4.4. Do not replace your files with the one I uploaded. Do the changes manually. It could be a problem with Pro - Gold and versions. Quote:
__________________
X-Cart Next: Business 5.2 (learning and testing) X-Cart Classic: Gold and Gold Plus 4.7 Lots of Modules and Customizations OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions) You can catch my ideas here: http://ideas.x-cart.com |
|||||||||
#4
|
|||||||
|
|||||||
Re: How to change Add Date field for a Product
Hi ADDISON,
It works and on x-cart Pro 4.4.2 also. Thanks.
__________________
Chris X-Cart 4.4.2 |
|||||||
#5
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
How can you make it automatially display by newest
__________________
Richard Ultimate 5.4 testing |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
If you have installed Gold Plus or Gold + X-HotProducts module you can easy set up a product as new. Read this user manual page: http://help.x-cart.com/index.php?title=X-Cart:X-HotProducts
see in section (middle of the page): Ability to mark any product as new
__________________
X-Cart Next: Business 5.2 (learning and testing) X-Cart Classic: Gold and Gold Plus 4.7 Lots of Modules and Customizations OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions) You can catch my ideas here: http://ideas.x-cart.com |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
ah but that is version 4.5.5 for gold plus, I only have 4.5.4 gold plus.
Will it seperate the products into New arrivals and standard products?
__________________
Richard Ultimate 5.4 testing |
|||||||||
#8
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
Also, in your signature it says you are on version X-Cart Gold Plus: 4.5.6.
My file area shows 4.5.5 as the latest and the next version is announced as 4.6.0
__________________
Richard Ultimate 5.4 testing |
|||||||||
#9
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
I suggest you waiting for 4.6.0 instead of upgrading to 4.5.5 in order to get that feature.
If you read the manual, XC separates New Arrivals if you want this.
__________________
X-Cart Next: Business 5.2 (learning and testing) X-Cart Classic: Gold and Gold Plus 4.7 Lots of Modules and Customizations OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions) You can catch my ideas here: http://ideas.x-cart.com |
|||||||||
#10
|
|||||||||
|
|||||||||
Re: How to change Add Date field for a Product
We would like to get this to work for us, but when we go to change the date, it seems it's not updating the data. When we click "Apply Changes" on product_modify page, it doesn't save the edited date value.
Even after upgrading to XC 4.5.5 (from 4.5.2) and installing New Arrivals, the ability to enable any product as New Arrival does not function properly for us. If we have new products we have added on 10/12/2014 and enable them as new products, they show in our new arrivals section. But if we go to enable a product that was added in 2012, as a new product, it does not bump above the products added on 10/12/2014 and show as new product. EDIT: NEVERMIND! It's working perfectly, when we saved the product_modify.php file it seems that it didn't save the 'add_date' in the array, oops!
__________________
Marcello Canitano New Site: X-Cart v4.5.5 GOLD X-Cart Mobile v1.4.3 X-Payments v1.0.6 CDSEO Pro v2 Total Server Solutions xCDN www.silverhorseracing.com |
|||||||||
|
|||
X-Cart forums © 2001-2020
|