Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

  • Index
  •  » ClickCartPro 6
  •  » Adding extra fields to products and having them show in description

#1 01-29-2007 19:55:19

steveblueradio
Member
From: Belfast, Northern Ireland
Registered: 06-28-2004
Posts: 755
Website

Adding extra fields to products and having them show in description

Hi,
I'm looking to add extra product fields, to show more info in the product view. i need to add fields like:

Min CPU
Min HDD
Min RAM
Peripheral Devices.....elc

what is the easy way of doing this?


I'm Gene Hunt, Your DCI, And it's 1973, Nearly Dinner Time, I'm havin hoops........

Cheers,
Steve
-------------------

Offline

 

#2 01-30-2007 08:29:29

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Adding extra fields to products and having them show in description

Add those fields in RawDB admin under:

Kryptronic Hybrid X Core > Database: Connections, Backups and Raw Admin > Raw Database Admin

Choose the 'Maintain' function for the ccp0_prod table.  Once you add them they will be available in Manage Products immediately and will be available in your product detail and product category displays under the variable $proddisp['YOUR_COLUMN_NAME'].  I made that really easy in this version smile


Nick Hendler

Offline

 

#3 01-30-2007 16:51:49

steveblueradio
Member
From: Belfast, Northern Ireland
Registered: 06-28-2004
Posts: 755
Website

Re: Adding extra fields to products and having them show in description

thanks Nick smile


I'm Gene Hunt, Your DCI, And it's 1973, Nearly Dinner Time, I'm havin hoops........

Cheers,
Steve
-------------------

Offline

 

#4 02-03-2007 08:35:51

osussat
Member
Registered: 04-16-2005
Posts: 128

Re: Adding extra fields to products and having them show in description

So how would I display my custom field in the default product detail view layout below (I've marked where I'd like to enter the field called MANUFACTURER):

Code:

<?php 

// +--
// | Get variables we need to draw this display.
// +--

$app      = $this->globals('khxc.app');
$ns       = $this->globals('khxc.namespace');
$eol      = $this->globals('khxc.eol');
$proddisp = $this->globals('ecom.prod_proddetail');
$xid      = $proddisp['id'];
$id       = $this->xhtml_encode($xid);

if ($ns == 'addcart') {$ns = 'prodshow';}

$this->globals('ecom.prod_proddisp',$proddisp);
$this->globals('ecom.prod_priceinfo',$proddisp['khxc.priceinfo']);

// +--
// | Create the product name and description.
// +--

$prodname  = $this->xhtml_encode($proddisp['name']);
INSERT MANUFACTURER FIELD HERE
$proddesc  = $proddisp['desclong'];
$hastags   = $proddisp['deschastags'];

if (empty($proddesc)) {

Offline

 

#5 02-03-2007 08:42:13

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Adding extra fields to products and having them show in description

Assuming you named the field in the database manufacturer

Code:

$manufacturer = $this->xhtml_encode($proddisp['manufacturer']);

Reference it using the variable name $manufacturer

Offline

 

#6 02-03-2007 09:08:09

osussat
Member
Registered: 04-16-2005
Posts: 128

Re: Adding extra fields to products and having them show in description

Thanks for that
I have tried

Code:

$prodname  = $this->xhtml_encode($proddisp['name']);
$manufacturer = $this->xhtml_encode($proddisp['manufacturer']);
$proddesc  = $proddisp['desclong'];
$hastags   = $proddisp['deschastags'];

and I can't see the manufacturer

However


Code:

$prodname  = $this->xhtml_encode($proddisp['manufacturer']);
$proddesc  = $proddisp['desclong'];
$hastags   = $proddisp['deschastags'];

works fine....

Offline

 

#7 02-03-2007 09:12:41

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Adding extra fields to products and having them show in description

What you did that worked simply changed the use of the $prodname variable to contain the manufacturer instead of the product name.  If you didn't print or echo the variable $manufacturer elsewhere in the code you wouldn't have seen it.

Offline

 

#8 02-03-2007 09:31:06

osussat
Member
Registered: 04-16-2005
Posts: 128

Re: Adding extra fields to products and having them show in description

Ah, you star!!!  Thankyou so much for this.
Now to take things one step further.  Say, for example, my manufacturer is MANUFACTURER.  I would place a manufacturer logo file called MANUFACTURER-logo-small.gif in my images folder.  I would then like to call an image in the product detail layout to display the manufacturer logo along side the name.
In CCP5.1 I achieved this by something like

Code:

<img src="(CGIVAR)images_path(/CGIVAR)/(CGIVAR)product_MANUFACTURER(/CGIVAR)-logo-small.gif">

How would I do this in version 6?

I think it's going to take me some time to adjust to these changes, but they seem great so far!
Thankyou for all your help in this...

Offline

 

#9 02-03-2007 09:50:17

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Adding extra fields to products and having them show in description

osussat wrote:

I would place a manufacturer logo file called MANUFACTURER-logo-small.gif in my images folder.

What images folder?  One off of the root of your site, the media folder that khxc created or in the media folder that is below your skin folder?

If, for example, you put it in the media folder that khxc created (if you installed khxc in the root of your site) you could refer to it using

Code:

<img src="media/<?php echo $manufacturer; ?>-logo-small.gif">

If it's in a completely different directory off of the root of your site, lets call it Images, you could use:

Code:

<img src="/Images/<?php echo $manufacturer; ?>-logo-small.gif" alt="<?php echo $manufacturer; ?> Logo">

You want to use alt on any images to keep your pages XHTML strict compliant.

Offline

 

#10 02-03-2007 09:56:08

osussat
Member
Registered: 04-16-2005
Posts: 128

Re: Adding extra fields to products and having them show in description

Aha!  Suddenly the simplicity of this new interface is all too apparent!
Thankyou soooooo much for all your help here.
I have a ton of other questions, but for now, I can go along making some modifications and being extremely happy with CCP6
Thanks again smile

Offline

 

#11 02-05-2007 14:00:04

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Adding extra fields to products and having them show in description

And the light turns on...


Nick Hendler

Offline

 

#12 07-02-2007 17:22:31

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Adding extra fields to products and having them show in description

All of the information to add fields is in this thread as well as how to add the display of additional fields to the product details display.  Have you tried anything listed in this thread yet?

Offline

 

#13 07-02-2007 17:32:49

nicgregory
Member
Registered: 06-30-2007
Posts: 17

Re: Adding extra fields to products and having them show in description

Thanks for your reply Dave. Yes, I have done all that is outlined. I just wanted to know what was meant by "echo or print the $manafacturer variable elsewhere in the code" . I am just a beginner you see. But not to worry, I had already deleted my post having found the answer, so please ignore my previous post.

Offline

 

#14 07-02-2007 17:47:08

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Adding extra fields to products and having them show in description

No need or reason to delete your posts?  What I meant by that statement was, in the original post, the person had set the variable for the manufacturer but had not added any code to actually have it displayed.  Echo and Print are two functions in PHP that print (display) variables and static text.

Sorry if I came on "too strong".  Please don't hesitate to ask questions.  We all learn from questions.

Offline

 

#15 01-08-2008 21:30:13

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Adding extra fields to products and having them show in description

I'm trying to do the same thing here...as an example, i want to place the Short Description right near the logo (to test if it works before populating my user-defined new column in the product table).  Here's where I placed it:

Code:

<td id="skin_ht_lcol">

<a href="<?php print $link_home; ?>" title="Home"><img src="skins/zipskin_khxc001/media/newlogo001.jpg" alt="Home" width="350" height="48" /></a>
<?php print $proddisp['descshort']; ?>

</td>

the php print line is what isn't working...nothing's printed.

Anyone know what's wrong with my code?

Regards,

James...

Offline

 

#16 01-08-2008 21:50:25

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Adding extra fields to products and having them show in description

Where are you trying to get this to display, it look like you want it in the main skin (in or around the Home button)? The code looks good but if there is nothing in the variable you will not print anything meaning that a script has to build what's in proddisp before you can pull information from it.

John

Offline

 

#17 01-08-2008 21:56:43

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Adding extra fields to products and having them show in description

Hi John, I'm displaying it next to the main logo - not necessarily the final location but where I'm trying to see it for now - and i did populate the field for one product (I can see the text in the field when I view the product information using admin so I know text is stored there.

James...

Offline

 

#18 01-08-2008 22:07:06

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Adding extra fields to products and having them show in description

Is it possible, that skin.php is the wrong location for it?

James...

Offline

 

#19 01-08-2008 22:21:38

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Adding extra fields to products and having them show in description

That my be true but the script that is building the display where you are trying to get it to show doesn't build any product information or have any product information to work with. The proddisp array is only built by items that call the prodlist or prodshow scripts which builds the product information and then passes the array to the scripts that build the display for your products. Just because this information displays on a page (like the splash page) does not mean that every script that builds that page has the same information to work with. Most if not all the information is pulled, built for display and then removed so the server does not stack up allot of information it doesn't need in memory that would slow it down.

John

Last edited by dh783 (01-08-2008 22:23:33)

Offline

 

#20 01-08-2008 22:54:24

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Adding extra fields to products and having them show in description

So what's the solution?  Any ideas?

On a side note, i just visited a random category, then clicked on one of the 'recently visited pages' and my breadcrumb shows the current page, but the breadcrumb shows the last visited category as the category in the breadcrumb.  E.g. I visit category1, then click on product15 (which is only in category15), and my breadcrumb shows Store Home > Category1 > product15.  I tried with a few categories and it always keeps the last visited category if you click on a product from the breadcrumb.  What's up with that?

James...

Offline

 

#21 01-08-2008 23:02:02

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Adding extra fields to products and having them show in description

What will be in the new column of information for your products and where do you want it to display?

John

Offline

 

#22 01-08-2008 23:39:11

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: Adding extra fields to products and having them show in description

Basically some text that references important keywords related to that category (e.g. Baby gift baskets shipped across Canada!) - never more than 1-2 sentences, so I made it text varchar 255.  Appearing high on the page is important and it's a visual thing too appearing near the logo (filler space).

Offline

 

#23 01-09-2008 08:49:53

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Adding extra fields to products and having them show in description

Ok I haven't tried this yet but it should work. In your private_dir/khxc/app/ccp0/CCP_Prod edit CCP_Prod.php and look for where the metatitle is created which is near this:

Code:

// +--
// | Print breadcrumbs.  We use a '0' param here so we don't
// | kill any breadcrumbs we have already.
// |
// | Also modify our meta info.
// |
// | We only do this stuff if we're on the prodshow namespace.
// +--

add a new global for your information, I will use description in this example but  you can use any name that makes since to you, and you will have to use your data column name in the product call:

Code:

 $this->globals('khxc_display.description',$product['your_product_column_name_here']);

Next go to the skin that you are using and make an edit (update) in the skinfunc.php and place this code where it say

Code:

// +--
// | Meta tag and title variables.
// +--

$x['description']    = $this->xhtml_encode($this->globals('khxc_display.description'));

This should allow you to print this variable any where in the skin that you want by placing this code where you want it to display:

Code:

<?php print $description ?>

As I said earlier I haven't tried this and there could be a step that I am missing, if it doesn't work you will have to let me know, and also this is subject to be overwritten with a future update.

If you want this to work for categories as well you will need to make an edit in CCP_Cat/CCP_Cat.php where the  metatitle is created for them as well as making a new data column for the information in the categories database.

Also make backups of the effected files to be safe if something goes wrong.

John

Offline

 

#24 10-05-2009 03:36:52

tlg
Member
Registered: 10-11-2007
Posts: 50
Website

Re: Adding extra fields to products and having them show in description

I am stuck with this, can anyone help?

Here is where I am upto:

I have added a manufactuer column in my gbu0_prod table and for each product a manufacturer is listed.

In Manage Catalog Product Displays: Detail View, I have added the following:

Code:

$manufacturer = $this->xhtml_encode($proddisp['manufacturer']);

here:

Code:

$prodname  = $this->xhtml_encode($proddisp['name']);
$manufacturer = $this->xhtml_encode($proddisp['manufacturer']);
$proddesc  = $proddisp['desclong'];
$hastags   = $proddisp['deschastags'];

For each product I would like to display a small manufacturer image on the product detail page, just before the main description. Can anyone help me do this from this point?

Offline

 

#25 10-05-2009 08:24:35

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: Adding extra fields to products and having them show in description

This line in the product displays prints the description

Code:

<p><?php print $proddesc; ?></p>

you would need to create a similar print statement for your new field and include any hml need to create the display.

John

Offline

 
  • Index
  •  » ClickCartPro 6
  •  » Adding extra fields to products and having them show in description

Board footer