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.
Hi all
Please can you point me in the right direction of the settings to select a particular skin to display according to a user / user group?
Many thanks
Oli
Offline
CCP does not support skins on a per user or user group basis.
Offline
Hi Dave
Is this something that can be changed? I'd like our Staff to have access to more information about products than regular users.
Best
Oli
Offline
Not without a custom modification. However, the user group a logged in person is part of and their user information is available in global variables so you could build your product detail display to show more or less data based on that information fairly easily.
Offline
Hi Dave
Thanks again for coming back to me so quickly. I think I follow you. So we could use IF commands to check out the Usergroup global variable, and display product information differently depending on if the IF statement is true or not? That leads me into my next question of how on earth we add more fields to the product information screens!
Thanks as ever
Oli
Offline
osussat wrote:
So we could use IF commands to check out the Usergroup global variable, and display product information differently depending on if the IF statement is true or not?
Yes, exactly.
osussat wrote:
That leads me into my next question of how on earth we add more fields to the product information screens!
All of the product information is available in the product detail displays in the $proddisp PHP array. The index keys match the column names so, for example, the inventory level would be shown using $proddisp['invlevel']
Offline
That's right. You could include PHP code in your skin that adjusts the display based on the usergroup. This would be done like so:
<?php /* PHP FUNCTION: Skin startup */ $skinfunc =& $this->include_skinfunc('CORE_SkinFunc'); extract($skinfunc->startup()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta name="generator" content="Kryptronic Software" /> <meta name="keywords" content="<?php print $metakeywords; ?>" /> <meta name="description" content="<?php print $metadesc; ?>" /> <?php /* PHP FUNCTION: rints the robots tag */ $skinfunc->robotstag(); ?> <base href="<?php print $disp_baseurl; ?>" /> <link rel="stylesheet" type="text/css" media="all" href="skins/YOUR_SKIN_NAME_HERE/css/all.css" /> <?php /* PHP FUNCTION: Prints JavaScript Library code */ $skinfunc->namespace('core','jslib'); ?> <title><?php print $metatitle; ?></title> </head> <body> <?php $usergroup = $this->globals('core_users.usergroup'); if ($usergroup == 'superuser' || $usergroup == 'admin' || $usergroup == 'reports') { /* print HTML below for backend users. */ ?> <div id="skin_wrapper_full"><div id="skin_wrapper"> </div> <?php } elseif ($usergroup == 'wholesale' || $usergroup == 'affiliates') { /* print HTML below for wholesale and affiliate account users. */ ?> <div id="skin_wrapper_full"><div id="skin_wrapper"> </div> <?php } elseif ($usergroup == 'users') { /* print HTML below for regular basic user accounts. */ ?> <div id="skin_wrapper_full"><div id="skin_wrapper"> </div> <?php } else { /* print HTML below for users who are not logged in. */ ?> <div id="skin_wrapper_full"><div id="skin_wrapper"> </div> <?php } /* End of if statement.. */ /* PHP FUNCTION: Run the debug and closure function. */ $skinfunc->debug(); ?> </body> </html>
Offline
Brilliant! Thank you both, you are complete stars! I'll make a start and let you know how I get on
For the staff, I'd really like to display the product price in an editable box so that it can be altered before adding to the shopping cart...In CCP5 that was easily doable...is this still so in v7?
Offline
The price of items in the cart are check several time between the cart and the checkout screens to make sure they are the prices set in the database for what ever sales type so in the stock ccp code it is not possible to edit the price on the fly. Remote items do not get the same checks so a custom mod to change the status of an item to "REMOTE-item_id" would keep the price entered but as I said would take some custom code to do so.
John
Offline
Thanks John, it seems things have come on quite a bit from version 5 (which, of course, is great to see!).
Until I get my head around all of this, perhaps I've spotted another way around...I could create a product that was only visible to people in the STAFF usergroup and then in the Products section create a product of nil value and various product options hanging off of it with various negative price impacts....
That way, there is still a way of staff 'discounting'...
Offline
Oops, seems like CCP7 translates any product sub-zero in price to zero before adding it to the cart....DOH!
Offline
osussat wrote:
For the staff, I'd really like to display the product price in an editable box so that it can be altered before adding to the shopping cart...In CCP5 that was easily doable...is this still so in v7?
As John said, no it isn't. The price is checked against the product table at several stages and if it's different it will be adjusted back to the value that is in the product file.
Offline
You can have a zero price product and add to it. Or you can start with a high priced product and subtract from it. A product with a negative price could never be added to the cart because you'd go from having an online store to an online disbursement system. Look into the remote product add to cart functionality. That will let your users enter a price and will carry that (if it's positive) into checkout.
Offline
Thanks Nick, I'll take a look at that...Or else, perhaps I'll implement a load of discount codes that the staff can use...that should work, right?
Offline
Yes, discount codes would work. What exactly are you trying to accomplish?
Offline
I'd to all intents and purposes like to make our staff and consumer selling mechanism one entity (ie the website, run off CCP) , with the one difference being that staff can see more product information and can also discount items.
Offline
In that case discount codes probably offer you more control and accountability. If you have staff entering orders on behalf of customers you might be interested in the .
Offline
Hi guys
I'm having a little bit of trouble with the mod Dave/Nick suggested.
My product display is now as follows:
<?php // +-- // | Get variables we need to draw this display. // +-- $ns = $this->globals('core.namespace'); $eol = $this->globals('core.eol'); $proddisp = $this->globals('ecom.prod_proddetail'); $xid = $proddisp['id']; $id = $this->xhtml_encode($xid); // +-- // | New Variable Get. // +-- $usergroup = $this->globals('core_users.usergroup'); if ($ns == 'addcart') {$ns = 'prodshow';} $this->globals('ecom.prod_proddisp',$proddisp); $this->globals('ecom.prod_priceinfo',$proddisp['core.priceinfo']); // +-- // | Create the product name and description. // +-- $prodname = $this->xhtml_encode($proddisp['name']); $proddesc = $proddisp['desclong']; $desc_has_tags = $this->has_tags($proddesc); if (empty($proddesc)) { $proddesc = $proddisp['descshort']; $desc_has_tags = 0; } // End of if statement. if (empty($desc_has_tags)) {$proddesc = '<p>' . $this->xhtml_encode($proddesc) . '</p>';} // +-- // | Create the image tag(s). // +-- $imglist = $proddisp['imglg']; if (empty($imglist)) {$imglist = 'none.png';} $imglist = $this->make_list($imglist); $imgwidth = $this->globals('core_settings.ecom.imgsizeprodlg'); $imgtag = ''; if (empty($imgwidth)) {$imgwidth = 200;} foreach ($imglist as $num => $img) { $imgurl = 'media/ecom/prodlg/' . $img; $imgtag .= '<img src="' . $imgurl . '" '; if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';} $imgtag .= 'alt="' . $prodname . '" />'; } // End of foreach statement. // +-- // | Handle extra large image. // +-- $showxl = 0; $imglist = $proddisp['imgxl']; if (empty($imglist)) {$imglist = 'none.png';} if (($imglist) && ($imglist != 'none.png') && ($ns == 'prodshow')) { $this->globals('core.load_slimbox',1); $showxl = 1; $xlcount = 0; $xlimgtag = ''; $zlcount = count($imglist); $imglist = $this->make_list($imglist); if (count($imglist) == 1) {$text = 'View Larger Image';} else {$text = 'View Larger Image Slideshow';} foreach ($imglist as $num => $img) { $xlcount++; $xlurl = $this->globals('core.url_nonssl'); $xlurl .= '/media/ecom/prodxl/' . $img; if ($xlcount == 1) { $xlimgtag .= '<p><a href="' . $xlurl . '" rel="slimbox[prodgroup]" title="'; $xlimgtag .= $prodname . '" class="hrefbutton">' . $text . '</a></p>'; } else { $xlimgtag .= '<p class="hidden"><a href="' . $xlurl . '" rel="slimbox[prodgroup]" title="'; $xlimgtag .= $prodname . '" class="hrefbutton">' . $text . '</a></p>'; } // End of if statement. } // End of foreach statement. } // End of if statement. // +-- // | Print the display. // +-- ?> <table id="proddetail--<?php print $id; ?>" class="cptbl_det"> <tr class="cptbl_det"><td class="cptbl_det"> <table class="ghost"><tr><td class="ghost" style="width: <?php print $imgwidth; ?>px"> <?php print $imgtag; ?> <?php // +-- // | Handle the extra large image tag and email a friend link. // +-- $emailfr = $this->globals('core_settings.ecom.emailfriend'); if ($ns != 'prodshow') {$emailfr = 0;} if (($showxl) || ($emailfr)) { print '<div style="width:' . $imgwidth . 'px">' . $eol; if ($showxl) {print $xlimgtag;} if ($emailfr) { $link_emailf = $this->link_namespace('ecom','emailfriend',array('ref' => $proddisp['id'])); print '<p><a href="' . $link_emailf . '" title="Email a Friend" '; print 'class="hrefbutton">Email This Item to a Friend</a></p>'; } // End of if statement. print '</div>' . $eol; } // End of if statement. ?> </td><td class="ghost"> <p><strong><?php print $prodname; ?></strong></p> <?php print $proddesc; ?> <?php $this->include_file('ecom','pricedisp.php'); ?> </td></tr> </table> </td></tr></table> // +-- // | Check the user type and display something if there is a match. // +-- <?php if ($usergroup == 'superuser' || $usergroup == 'admin' || $usergroup == 'staff') { print 'THIS IS WORKING'; } ?> <?php // +-- // | Print the product options if we can add the item to the // | shopping cart or wish list and we're on the prodshow // | namespace. // +-- $add_ok = 1; if (($proddisp['useinv']) && (!($proddisp['invlevel'] > 0))) {$add_ok = 0;} if ($proddisp['pricestatus'] == 'D') {$add_ok = 0;} if (($ns == 'prodshow') && ($add_ok)) { $this->include_namespace('ecom','prodshowopt',array()); } // End of if statement. if (($ns == 'prodshow') && ($add_ok)) { $this->globals('xmodshipestimator_prodid',$xid); $this->include_namespace('ecom','xmodshipestimator'); } // End of if statement. ?>
Note the two changes highlighted...No matter if I'm logged in as admin or otherwise, the change doesn't take effect.
Any ideas gang?
Oli
Last edited by osussat (07-25-2009 06:12:55)
Offline
There's no bold since you (correctly) enclosed the code with code tags so it's really difficult to see what you modified.
Offline
Sorry Dave, I'm a dufus!
I've re-edited
Offline
You're retrieving the wrong global variable. The user group global variable name is .
BTW, when you use code tags no highlighting or coloring works.
Offline
CHAMPION! Thanks Dave!
Offline
If I wanted to make a similar change with regards to product option displays as opposed to main product displays, where would I go about finding the relevant codes?
Oli
Offline
Options are displayed from within the product detail display. Look near the end of what you posted.
$this->include_namespace('ecom','prodshowopt',array());
Offline
Perhaps I'm being silly buy I just can't find where to edit how the options display...The prodshowopt namespace screen doesn't give much away...
Offline