Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Copying title to meta

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-23-2014, 12:22 PM
 
Dougrun Dougrun is offline
 

X-Adept
  
Join Date: Apr 2012
Posts: 895
 

Default Copying title to meta

can anyone write me a SQL code that copies my product name into the title tag, meta keywords and meta description boxes so i dont have to go through 2000 product pages? I cant seem to find the tables they are stored in.
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #2  
Old 04-23-2014, 05:33 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Copying title to meta

Off the top of my head (untested), how about something like this:

UPDATE: This did not work
Code:
UPDATE xcart_products p SET (title_tag, meta_keywords, meta_description) = ( SELECT product, product, product FROM xcart_products_lng_en pl WHERE pl.productid = p.productid );
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #3  
Old 04-24-2014, 07:58 AM
 
Dougrun Dougrun is offline
 

X-Adept
  
Join Date: Apr 2012
Posts: 895
 

Default Re: Copying title to meta

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(title_tag, meta_keywords, meta_description) = (
SELECT product, product, pro' at line 2
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
  #4  
Old 04-24-2014, 08:20 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Copying title to meta

Maybe something like this instead (untested):

UPDATE: This did not work (probably would for MSSQL)
Code:
UPDATE xcart_products p SET title_tag = pl.product, meta_keywords = pl.product, meta_description = pl.product FROM xcart_products_lng_en pl WHERE pl.productid = p.productid );
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #5  
Old 04-24-2014, 10:36 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Copying title to meta

In 4.6.x product name is NOT in products table so this will not work. Same for product's meta tags

They are all in product XX table - XX being language
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 04-24-2014, 11:43 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Copying title to meta

What won't work?
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #7  
Old 04-24-2014, 12:19 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Copying title to meta

The query won't work the way it is.

This

UPDATE xcart_products, xcart_products_lng_en SET xcart_products.title_tag = xcart_products_lng_en.product, xcart_products.meta_keywords = xcart_products_lng_en.product, xcart_products.meta_description = xcart_products_lng_en.product WHERE xcart_products.productid = xcart_products_lng_en.productid;

But make sure you backup first
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #8  
Old 04-24-2014, 08:22 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Copying title to meta

Thanks for clarifying. However, the query did not fail because of the location of the product name. Your implicit JOIN is interesting but not clear. I prefer this:
Code:
UPDATE xcart_products p JOIN xcart_products_lng_en pl ON pl.productid = p.productid SET title_tag = pl.product, meta_keywords = pl.product, meta_description = pl.product
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #9  
Old 04-24-2014, 09:37 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Copying title to meta

Either way, as long as it works...
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:00 PM.

   

 
X-Cart forums © 2001-2020