Zen Cart Logo
Forums / Basic Configuration / Show Date Added?

Show Date Added?

Locked

Views: 2,581

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
17 Feb 2009, 11:39 PM
#1
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Show Date Added?

I am confused about the correct way to turn off the statemnet "This product was added to our catalog on....."

I turned it off for all the listing types in

Admin -> Configuration -> New Listing, Featured Listing and All Listing.

The initial values in all cases were 2601. This is a code which indicates the alignment, sort order and number breaks. 0 means off. So i set all 3 to zero.

However, this did not turn the statement off. Searching the forum I found a post instructing me to use Admin -> Catalog -> Product Types then hit the Edit Layout button and change the value of "Show Date Added" from 1 to 0.

From what I can gather this means the statement has to be turned off in 2 places. Are there any differences between these settings, that is, the one in Admin -> Configuration-> <listing type> and the one in Admin -> Catalog -> Product Types?

Thanks

Kev

17 Feb 2009, 11:48 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,606
Plugin Contributions:
0

Re: Show Date Added?

Your URL?

17 Feb 2009, 11:54 PM
#3
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

My URL is

www.f u n a d u l t c o s t u m e s .co.uk

Do you need the URL? I have managed to remove the statemenet - i am just wondering why it needs to be turned off in 2 places - if indeed it does?

Kev

18 Feb 2009, 12:01 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

Settings in Configuration -> New Listing, Featured Listing and All Listing will affect only those pages. The Product Types setting affects the product info page.

18 Feb 2009, 12:04 AM
#5
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Thanks gjh,

perhaps this is a stupid question, but what is the difference between the poduct info page and all listing page?

18 Feb 2009, 12:06 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

"Product info" is the name for the individual product details page.
I recall that it confused me when I first started working with Zen Cart.

18 Feb 2009, 12:11 AM
#7
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Thanks Glenn,

good news and bad news. I have found the "All Listings", "New Listings" and "Product Info" pages now, so I appreciate they are different.

However, with Admin -> Catalog -> Product Types -> Edit Layout -> SHow Date Added set to 0 (off) and Admin -> Configuration -> New Listings -> Display Date Added set to 2601 (left aligned, order 60, 1 break), the "New Listing" page does not display the date added.

"New Listing" only shows date added when it is set to 2601 and Catalog -> Product Types -> Layout is 1. Is this correct? A bug maybe?

Kev

18 Feb 2009, 12:18 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

Hmm, I don't know. One of the first things I ever did with my shop was turn that completely off, so I haven't investigated its behavior.

18 Feb 2009, 12:34 AM
#9
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Well the logic for it is in here:

includes\functions\function_lookups.php
function zen_get_show_product_switch

First off it gets the product_type (id) from TABLE_PRODUCTS using the appropriate product_id. Lets say it returns id 1, typically "Product - General"

Next it gets the type_handler (???) from TABLE_PRODUCT_TYPES for the product type id found above. Lets say it finds the handler "product".

So, so far, even though we are loading the "New Listings"page it still hasn't looked at the settings in Configuration => New Listing -> ....

Next a string is generated which is (take this on trust, for this example): SHOW_PRODUCT_INFO_DATE_ADDED

ok - will stop my explanation now....was it helping anyway - I will post the PHP.

K

18 Feb 2009, 12:37 AM
#10
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Here is the function

function zen_get_show_product_switch($lookup, $field, $suffix= 'SHOW_', $prefix= 'INFO', $field_prefix= '', $field_suffix='') {
global $db;

  $sql = "select products_type from " . TABLE_PRODUCTS . " where products_id='" . $lookup . "'";
  $type_lookup = $db->Execute($sql);

  $sql = "select type_handler from " . TABLE_PRODUCT_TYPES . " where type_id = '" . $type_lookup->fields['products_type'] . "'";
  $show_key = $db->Execute($sql);


  $zv_key = strtoupper($suffix . $show_key->fields['type_handler'] . $prefix . $field_prefix . $field . $field_suffix);

// MY EXPLANATION ABOVE STOPS HERE

  $sql = "select configuration_key, configuration_value from " . TABLE_PRODUCT_TYPE_LAYOUT . " where configuration_key='" . $zv_key . "'";
  $zv_key_value = $db->Execute($sql);
  if ($zv_key_value->RecordCount() > 0) {
    return $zv_key_value->fields['configuration_value'];
  } else {
    $sql = "select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key='" . $zv_key . "'";
    $zv_key_value = $db->Execute($sql);
    if ($zv_key_value->RecordCount() > 0) {
      return $zv_key_value->fields['configuration_value'];
    } else {
      return false;
    }
  }
}

So what it does after my explanation is to query the product type layout to see if it should display the date added. It will return a 1 or 0. I think it must return something. So that determines if the date is shown or not.

** IF ** no value is returned BUT I SUSPECT ONE WILL then the Configuration -> New Listing settings are interrogated. So I don't think this setting will ever be used!

in other words, Date Added is either on or off globally.

Can a true Zen guru confirm this?

Kev

18 Feb 2009, 12:42 AM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

At any rate, if turning off the date added in Product Types completely disables it, I expect that was the intended behavior, so it couldn't be called a bug. You may be able to work around it and make your own store behave differently.

I'll have to look through the code you posted and see what I can make of it.

18 Feb 2009, 12:48 AM
#12
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Thanks Glen, I agree - it may not be a bug - it simply depends on what those settings are "supposed" to do. I think my explanation of what they "really" do is correct - but an expoert needs to double check my logic.

18 Feb 2009, 1:00 AM
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

  $sql = "select configuration_key, configuration_value from " . TABLE_PRODUCT_TYPE_LAYOUT . " where configuration_key='" . $zv_key . "'";
  $zv_key_value = $db->Execute($sql);
  if ($zv_key_value->RecordCount() > 0) {
    return $zv_key_value->fields['configuration_value'];
  } else {
    $sql = "select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_key='" . $zv_key . "'";
    $zv_key_value = $db->Execute($sql);
    if ($zv_key_value->RecordCount() > 0) {
      return $zv_key_value->fields['configuration_value'];
    } else {
      return false;
    }
  }
}

If this first key_value is greater than 0, the configuration_value is returned from TABLE_PRODUCT_TYPE_LAYOUT and the rest is skipped over; if equal to 0, the next test is performed.

If the second key_value is greater than 0, the configuration_value is returned from TABLE_CONFIGURATION; if equal to 0, "false" is returned.

18 Feb 2009, 1:06 AM
#14
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

Hi Glenn,

I suspect that is how it is meant to work, but the code doesn't compare against the returned value, it compares against the RecordCount, which will always be 1 as far as I am aware, hence the second SQL clause never gets executed.

18 Feb 2009, 5:35 AM
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show Date Added?

If $zv_key is not in the table, there would be no records in $zv_key_value, correct?

It would take more digging to find out what that would be in various cases, but it might be intended as a fallback - if not defined in product types, check configuration... but it does seem like the product types setting always overrules the listing settings.

18 Feb 2009, 8:39 AM
#16
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Show Date Added?

If $zv_key is not in the table, there would be no records in $zv_key_value, correct?

Agreed, and you are right, more diggng required. I have traced it for "New P"oduct" page and $zv_key becomes SHOW_PRODUCT_INFO_DATE_ADDED which I think will always exist (as it will either be 1 or 0). i will look more deeply as the other setting (Admin -> Configuration -> New Listings) is supposed to specify a format and I haven't looked for where this would/does get rendered.

Thanks Glenn - good to have someone to bounce ideas/theories and questions at.

Kev