Forums / Templates, Stylesheets, Page Layout / duplicate reviews sidebox?

duplicate reviews sidebox?

Locked

Started by amandagero on 6 May 2009, 8:06 AM · Views: 2,206

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
6 May 2009, 8:06 AM
#1
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

duplicate reviews sidebox?

i need to duplicate the reviews sidebox, and rename it concerts.
im wondering if there is a "list" in someones head of the files i need to duplicate, i have duplicated all that i can find, but im fearing im missing some. I havent tried it yet, because i know that i need to run an sql command, im just not sure what.

can someone help me please?

6 May 2009, 3:30 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

Sideboxes have two peices:
/includes/modules/sideboxes/my_sidebox.php
/includes/templates/template_default/sideboxes/tpl_my_sidebox.php

You might look at the Free Software add on for the Blank Sidebox to get a feel for this and how new ones can be added ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 May 2009, 7:27 PM
#3
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

ok, thank you. i will look at it as soon as i get a few minutes. does anybody know about the sql query i will need though? im sure it will use one, because when someone posts a review, i am assuming it gets stored in the database, so to duplicate that, and have someone post a concert, that will need to be stored as well. am i correct?

7 May 2009, 3:59 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

Assuming you followed the pattern of Reviews ...

Look at how your data is stored in your new concerts and concerts_description tables ...

You should be able to use similar SELECT statements where the fields match your new tables but those should be similar to how the Reviews are setup ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 May 2009, 4:32 PM
#5
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

how do i view that? in phpMyAdmin? im sorry, im just not sure. would it be in a php file? or is it a query that is run everytime.

7 May 2009, 7:04 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

I am assuming that you added new tables to the database to manage your concerts ...

The current Review sidebox uses:
/includes/modules/sideboxes/reviews.php

and uses one of three template files:
/includes/templates/template_default/sideboxes/tpl_reviews_random.php
/includes/templates/template_default/sideboxes/tpl_reviews_write.php
/includes/templates/template_default/sideboxes/tpl_reviews_none.php

The SELECT statements are in the module file for this to get the data out of the database tables ...

This can help give you ideas of how to get your data for the concerts out of the database tables ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 May 2009, 9:38 PM
#7
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

ok, thank you. that was very helpful., i guess when i quick installed it, the prefix zen_ was added, i edited all 4 files, created the tables first of course.

i think the problem lies in the file concerts.php, in the modules directory, here is my code, im just not sure where to add the prefixes in the file

$concerts_status = " and r.status = 1 ";

  $random_concert_sidebox_select = "select c.concerts_id, c.concerts_rating, p.products_id, p.products_image, pd.products_name
                    from " . TABLE_ZEN_CONCERTS . " c, " . TABLE_CONCERTS_DESCRIPTION . " cd, "
                           . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                    where p.products_status = '1'
                    and p.products_id = c.products_id
                    and c.concerts_id = cd.concerts_id
                    and cd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
                    and p.products_id = pd.products_id
                    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                    $concerts_status;

  if (isset($_GET['products_id'])) {
    $random_concert_sidebox_select .= " and p.products_id = '" . (int)$_GET['products_id'] . "'";
  }
  $random_concert_sidebox_select .= " limit " . MAX_RANDOM_SELECT_CONCERTS;
  $random_concert_sidebox_product = zen_random_select($random_concert_sidebox_select);
  if ($random_concert_sidebox_product->RecordCount() > 0) {
// display random review box
    $concert_box_text_query = "select substring(concert_text, 1, 60) as concerts_text
                     from " . TABLE_CONCERTS_DESCRIPTION . "
                     where concerts_id = '" . (int)$random_concert_sidebox_product->fields['concerts_id'] . "'
                     and languages_id = '" . (int)$_SESSION['languages_id'] . "'";

    $concert_box_text = $db->Execute($concert_box_text_query);

//    $review_box_text = zen_break_string(zen_output_string_protected($review_box_text->fields['reviews_text']), 15, '-<br />');
    $concert_box_text = zen_break_string(nl2br(zen_output_string_protected(stripslashes($concert_box_text->fields['concerts_text']))), 60, '-<br />');

    require($template->get_template_dir('tpl_concerts_random.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_concerts_random.php');
  } elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
// display 'write a review' box
    require($template->get_template_dir('tpl_concerts_write.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_concerts_write.php');
  } else {
// display 'no reviews' box
    require($template->get_template_dir('tpl_concerts_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_concerts_none.php');
  }
  $title =  BOX_HEADING_CONCERTS;
  $title_link = FILENAME_CONCERTS;
  require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
?>
7 May 2009, 9:42 PM
#8
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

sorry, i dont mean to double post, im just realizing that it might not be a pefix issue, here is mySQL code, maybe i have an error there?```
DROP TABLE IF EXISTS concerts;
CREATE TABLE concerts (
concerts_id int(11) NOT NULL auto_increment,
products_id int(11) NOT NULL default '0',
customers_id int(11) default NULL,
customers_name varchar(64) NOT NULL default '',
concerts_rating int(1) default NULL,
date_added datetime default NULL,
last_modified datetime default NULL,
concerts_read int(5) NOT NULL default '0',
status int(1) NOT NULL default '1',
PRIMARY KEY (concerts_id),
KEY idx_products_id_zen (products_id),
KEY idx_customers_id_zen (customers_id),
KEY idx_status_zen (status),
KEY idx_date_added_zen (date_added)
) TYPE=MyISAM;

DROP TABLE IF EXISTS concerts_description;
CREATE TABLE concerts_description (
concerts_id int(11) NOT NULL default '0',
languages_id int(11) NOT NULL default '0',
concerts_text text NOT NULL,
PRIMARY KEY (concerts_id,languages_id)
) TYPE=MyISAM;


and i did fix the ```
$concerts_status = " and r.status = 1 ";

to what it should be ```
$concerts_status = " and c.status = 1 ";

8 May 2009, 1:06 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

The table constant definitions manage prefixes ...

You have a constant:
TABLE_ZEN_CONCERTS

I would call this:
TABLE_CONCERTS

and then define it as the other tables are defined, for example, the reviews table is defined as:
define('TABLE_REVIEWS', DB_PREFIX . 'reviews');

This will "pickup" the table prefix if it is used from the configure.php file:
define('DB_PREFIX', '');

It there are prefixes used, they would be contained in that constant definition ...

What are the constants for your new tables and what are the definitions used to define them?

Where did you place these definitions?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 May 2009, 9:08 PM
#10
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

i changed the mod file lijke you said,

the definitions are here:

includes/languages/english/extra_definitions/concerts.php

define('BOX_HEADING_CONCERTS', 'Concerts');
define('BOX_CONCERTS_WRITE_CONCERT', 'Post a Concert related to this music.');
define('BOX_CONCERTS_NO_CONCERTS', 'There are currently no concerts.');
define('BOX_CONCERTS_TEXT_OF_5_STARS', '%s of 5 Stars!');
define('TEXT_CONCERT_BY', 'by %s');
define('TEXT_CONCERT_WORD_COUNT', '%s words');
define('TEXT_CONCERT_RATING', 'Rating: %s [%s]');
define('TEXT_CONCERT_DATE_ADDED', 'Date Added: %s');
define('TEXT_NO_CONCERTS', 'There are currently no concerts.');

includes/languages/english/concerts.php

define('NAVBAR_TITLE', 'Concerts');

define('TEXT_OF_5_STARS', '');



define('TEXT_PRODUCT_INFO', 'Music Information');

define('TEXT_READ_CONCERT', 'View Concert');
9 May 2009, 3:02 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

Everything on the error that is in caps are constants:

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 'MAX_RANDOM_SELECT_CONCERTS' at line 8
in:
[select c.concerts_id, c.concerts_rating, p.products_id, p.products_image, pd.products_name from TABLE_CONCERTS c, TABLE_CONCERTS_DESCRIPTION cd, zen_products p, zen_products_description pd where p.products_status = '1' and p.products_id = c.products_id and c.concerts_id = cd.concerts_id and cd.languages_id = '1' and p.products_id = pd.products_id and pd.language_id = '1' and c.status = 1 limit MAX_RANDOM_SELECT_CONCERTS]

You need each of these defined somewhere for the select statement to work ...

You could add them all in a file such as:
/includes/extra_datafiles/extra_concerts.php

That is a self loading directory that can pickup all of the new table names and the maximum value for this ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

9 May 2009, 4:12 PM
#13
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

ok thank you ajeh. where are they defined for the reviews? that way, i can copy from there, and change everything to concerts like i have been doing. thank you once again.

9 May 2009, 7:46 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

You might peek at the Tools ... Developers Tool Kit ... that can help you locate all defines in the php code ...

The Maximum Value is set in the database configuration table but it can be defined in a file to make it easier ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

13 May 2009, 8:06 PM
#15
amandagero avatar

amandagero

Zen Follower

Join Date:
Feb 2009
Posts:
188
Plugin Contributions:
0

Re: duplicate reviews sidebox?

ok, thank you i think this is a bit over my head though.

14 May 2009, 4:04 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: duplicate reviews sidebox?

If you know you are looking for a constant for:
MAX_RANDOM_SELECT_REVIEWS

You can look in the Developers Tool Kit in the bottom input box and enter:
MAX_RANDOM_SELECT_REVIEWS

select Catalog and click Search ...

If you do not find the DEFINE for this then it may be in the database, so enter in the top input box:
MAX_RANDOM_SELECT_REVIEWS

select none and click Search ...

Now your constants appear to be the maximum value, which is in the database and the table names ...

You are better off adding those to your own file and adding to the:
/includes/extra_datafiles/concerts.php

I chose that location as those settings are more related to the database and you want to ensure that they load sooner ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!