If this is your first visit, check our documentation. To post, register or login.

Login for price

Started by nick1973 on 23 Aug 2017, 6:20 PM · Views: 3,660

Results 1 to 12 of 12
23 Aug 2017, 6:20 PM
#1
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Login for price

[Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here. And, remove this comment before actually posting!]

I have a cart set up where prices can only be viewed when customers login, if logged out it is displaying Login for price.

Login for price displays on the product listing, but it doesn't display on centerboxes for new products, featured products, specials etc. How would I apply the same function to these centerboxes. Currently I have manually applied it, but once logged in the prices display and it still says 'Login for price' underneath the price. I want Login for price to disappear from center boxes once logged in, just like it does on the product listing.

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

23 Aug 2017, 6:26 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Login for price

You can determine if they are logged in using: $_SESSION['customer_id']
If it's not defined, they're not logged in.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

23 Aug 2017, 6:46 PM
#3
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Login for price

Ok where would I put this for the new products centerbox?

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

23 Aug 2017, 8:14 PM
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Login for price

Easiest method might be in the includes/languages/english.php. All the defines are around lines 484 -- 491.

  if ($_SESSION['customer_id']  > 0) { 
  define('TABLE_HEADING_FEATURED_PRODUCTS','Featured Products');
  define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
  define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
  define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');
  define('TABLE_HEADING_SPECIALS_INDEX', 'Monthly Specials For %s');
  } else { 
  define('TABLE_HEADING_FEATURED_PRODUCTS','Log in to See Prices For Featured Products');
  define('TABLE_HEADING_NEW_PRODUCTS', 'Log in to See Prices For New Products For %s');
  define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Log in to See Prices For Upcoming Products');
  define('TABLE_HEADING_DATE_EXPECTED', 'Log in to See Prices For Date Expected');
  define('TABLE_HEADING_SPECIALS_INDEX', 'Log in to See Prices For Monthly Specials For %s');
  }

Adjust the text to suit your taste.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

23 Aug 2017, 8:29 PM
#5
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Login for price

dbltoe:

Easiest method might be in the includes/languages/english.php. All the defines are around lines 484 -- 491.

if ($_SESSION['customer_id'] > 0) {
define('TABLE_HEADING_FEATURED_PRODUCTS','Featured Products');
define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');
define('TABLE_HEADING_SPECIALS_INDEX', 'Monthly Specials For %s');
} else {
define('TABLE_HEADING_FEATURED_PRODUCTS','Log in to See Prices For Featured Products');
define('TABLE_HEADING_NEW_PRODUCTS', 'Log in to See Prices For New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Log in to See Prices For Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Log in to See Prices For Date Expected');
define('TABLE_HEADING_SPECIALS_INDEX', 'Log in to See Prices For Monthly Specials For %s');
}

> 
> Adjust the text to suit your taste.

ok got you :-) thank you

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

1 Sep 2017, 9:05 AM
#6
nick1973 avatar

nick1973

Totally Zenned

Join Date:
Sep 2008
Location:
Cleethorpes
Posts:
1,230
Plugin Contributions:
3

Re: Login for price

Nick1973:

ok got you :-) thank you

Ok how would I use this here:

$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<div class="productListingImageContainer"><a class="productListingImage" href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a></div><br />') . '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a></h3><br />' . $products_price . '<a href="index.php?main_page=login">Login for price</a>');

Note the bit

<br />' . $products_price . '<a href="index.php?main_page=login">Login for price</a>');

I tried:

if ($_SESSION['customer_id'] > 0) {
'<a href="index.php?main_page=login">Login for price</a>';
} else {
$products_price;
}

Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk

1 Sep 2017, 3:16 PM
#7
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Login for price

nick,
if you use the bbcode tags, it makes it easier for some of us to read. see: https://www.bbcode.org/reference.php

i would modify the $products_price prior to its use in the statement. perhaps something like this:

$products_price = ($_SESSION['customer_id'] > 0 ? $products_price : '<a href="index.php?main_page=login">Login for price</a>');

$list_box_contents[$row][$col] = array(
    'params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' :
            '<div class="productListingImageContainer"><a class="productListingImage"
                                             href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">'
        . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'],
        IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a></div><br/>') .
        '<h3 class="itemTitle"><a
            href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">'
        . $new_products->fields['products_name'] . '</a></h3><br/>' . $products_price);

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

1 Sep 2017, 5:06 PM
#8
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Login for price

if ($_SESSION['customer_id'] > 0) {
'<a href="index.php?main_page=login">Login for price</a>';
} else {
$products_price;
}
```Try reading this versus looking at code.  To me, it says:

If the customer is logged in give them a link to log in.

OR

If the customer is not logged in give them the price.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

19 Oct 2023, 1:11 AM
#9
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

Re: Login for price

I am using Responsive_Classic 1.5.8a and I have the cart set-up to must login to view prices. All is good except I cannot figure out how to style the words "login for price" it's too small and I want to increase the size of that text. I can see the styling for list-price, but that does not work for me as it will not adjust the "login for price" words. The website is comfortpricefurniture.com. Any help would be awesome. Thank you.

19 Oct 2023, 1:52 AM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Login for price

To the template's /css/stylesheet.css, add

.list-price+a { font-size: larger; }

... or the specific font-size you want instead of the more general larger. Note that the .list-price element has a font-size of 1.5em.

That selector, BTW, indicates that the styling applies to an anchor tag (<a>) that directly follows an element with a class of list-price.

19 Oct 2023, 1:59 AM
#11
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

Re: Login for price

lat9:

To the template's /css/stylesheet.css, add

.list-price+a { font-size: larger; }

... or the specific font-size you want instead of the more general larger. Note that the .list-price element has a font-size of 1.5em.

That selector, BTW, indicates that the styling applies to an anchor tag (<a>) that directly follows an element with a class of list-price.

Wow, That has been racking my brain and you saved me a migraine. Thank you so much, worked perfect. Out of curiosity, I noticed that I have a stylesheet for buttons, is there a setting somewhere in the configuration settings to turn the buttons on? Thanks again!

19 Oct 2023, 2:04 AM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,142
Plugin Contributions:
56

Re: Login for price

chuckrey:

Wow, That has been racking my brain and you saved me a migraine. Thank you so much, worked perfect. Out of curiosity, I noticed that I have a stylesheet for buttons, is there a setting somewhere in the configuration settings to turn the buttons on? Thanks again!
You're very welcome. CSS Buttons are enabled via Configuration :: Layout Settings :: CSS Buttons (the last entry).