Adding New Product_types

Sticky

Views: 161,400

Results 41 to 60 of 154
30 Sep 2005, 5:54 PM
#41
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Adding New Product_types

Darkwander the dvd sql in your download file link a few posts back does not have those fields mentioned in it I think.....

So you need to search for 'products p, products_description pd' in your other code areas in admin files and see what goes on, presumably its a collect_info.php admin page for your selected/ edited product type

its either before it, which is probably a 'select' something,
or after, in which case a field name or syntax comma is wrong

I usually show the sql instruction by 'echo' at the faulty place
to show it on the page, its then obvious, but sometimes it needs the code rearranging to get at the sql statement itself as a 'printable' item

hope this helps rather than hinders

1 Oct 2005, 2:32 PM
#42
darkwander avatar

darkwander

Zen Follower

Join Date:
May 2005
Location:
Australia
Posts:
321
Plugin Contributions:
0

Re: Adding New Product_types

Hey all, i have got it all working, looks and runs unreal , however now i am trying to make it so that the group "Category" is multi-input , like Starring, i have got it so that it has the "5" boxes showing up and also allows you to select the different categories.

However the problem i am having is it saving the informaation, it dosnt want to save the different types , it just seems to save the first drop down box to the other 4 boxes as well..

Any ideas on where i am going wrong ?

zen_demo_dvd.2.12.rar

2 Oct 2005, 10:34 AM
#43
darkwander avatar

darkwander

Zen Follower

Join Date:
May 2005
Location:
Australia
Posts:
321
Plugin Contributions:
0

Re: Adding New Product_types

Okey the biggest problem i am having is with it saving the data...

This is the line that i am suppecting that is screwing up because when i make Categories like Starring , it saves , however i also want it to be like Studio. Basically i want a set of 5 dropdown boxes in which it pulls the data from the Categories table. That all works fine, it isnt just saving the enteries when i do "edit" or "New product"

this is the lines of code

** <tr bgcolor="#ebebff">
<td class="main" valign="top"><?php echo TEXT_DVD_CATEGORY; ?></td>
<td class="main">
<!-- table 1 -->
<table cellspacing=0 cellpadding=0><tr><td>
<?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ''; ?>
</td>
<td>
<!-- table 2 -->
<table cellspacing=0 cellpaddin=0>
<?php
$num_categories = 5;
echo "<input type=hidden name=num_categories value='{$num_categories}'>";

for($i=1; $i <= $num_categories; $i++){
	$c_category_name = $pInfo->{'category_name'.$i};       
 echo "<tr class='smallText'><td>";   
 echo "<input type=hidden name=category_order{$i} value='{$i}'>";
 echo zen_draw_separator('pixel_trans.gif', '24', '15') . '' . zen_draw_pull_down_menu('category_name{$i}', $categories_array, $pInfo->category_id);
 echo "</td></tr>\n";
}//end of for loop
  ?>  
  </tr></td></table>
  <!-- end of table 2 -->
 </td>
 </tr>
 </table>
 <!-- end of table 1 -->      
  </td>
 </tr>

**

I suppect it is this line

echo zen_draw_separator('pixel_trans.gif', '24', '15') . '' . zen_draw_pull_down_menu('category_name{$i}', $categories_array, $pInfo->category_id);
because when i make it the same as the Starring line (what books called ""Authors" it works. However they are no dropdown boxes , they are text boxes..

here is the line for Starring (authors)

echo "<input type=text name=starring_name{$i} value='{$c_starring_name}'>";

Help please......

5 Oct 2005, 6:27 PM
#44
darkwander avatar

darkwander

Zen Follower

Join Date:
May 2005
Location:
Australia
Posts:
321
Plugin Contributions:
0

Re: Adding New Product_types

Help please.....

5 Oct 2005, 7:07 PM
#45
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Adding New Product_types

Try searching throughout zencart for a

zen_draw_pull_down_menu('category_name{$i},...
``` I can't see one with an entry like wot you have it's weirdly weird

The function is

function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false)


.. so you need a single string or variable ```
$name
```for the first parameter, which gives the name of the html input field?

But you've got curly brackets, I might be nuts 

Maybe just try a string 'test' in that first parameter position see if it works betta, but maybe you forgot to put the first parameter in at all........

Its the second parameter that is the array, I tink you will find, because that's where it finds the multiple dropdown values

Its worth always finding the actual function and look at exactly how it works so you completely see what it's up to 

If you get that hot feeling don't worry, i get it as well as I did just now, I only half know what I'm trying to explain

Got to go, cat's saying its not been fed enough :)
7 Nov 2005, 8:19 PM
#46
thunderbird avatar

thunderbird

New Zenner

Join Date:
Sep 2005
Posts:
38
Plugin Contributions:
0

Re: Adding New Product_types

I have installed both the Book demo and DVD demos and both work correctly. My question is how do I change the fields with the drop down menus into a simple text box. I won't be doing anything I need the drop down boxes for.

Thanks

8 Nov 2005, 4:01 AM
#47
darkwander avatar

darkwander

Zen Follower

Join Date:
May 2005
Location:
Australia
Posts:
321
Plugin Contributions:
0

Re: Adding New Product_types

Which fields do you want to change...

8 Nov 2005, 2:29 PM
#48
thunderbird avatar

thunderbird

New Zenner

Join Date:
Sep 2005
Posts:
38
Plugin Contributions:
0

Re: Adding New Product_types

I want to change the Category, Format, Rated, Studio and Pub Date back to just the text Box

9 Nov 2005, 1:52 PM
#49
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

Hi,

So believe I've most of the product type correctly. I went to look at my work in admin section (by creating a new product) and all the extra fields I created were empty drop down menus.

One field was for a "publication date." I was able to find and modify the code for a calendar input with no problem. But I'm having the darndest time creating simple text fields. I've been trying to modify the products_name code to work with my field.

Below is the code I'm getting stuck on. It goes in the collect_info.php file

<?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '' . zen_draw_input_field('pages_id[' . $languages[$i]['id'] . ']', (isset($products_pages[$languages[$i]['id']]) ? stripslashes($products_pages[$languages[$i]['id']]) : zen_get_pages_id($pInfo->products_id, $languages[$i]['id'])), zen_set_field_length(TABLE_PRODUCT_PRINT_EXTRA, 'pages_id')); ?>

I'm also wondering if part of the problem is also in the main_template_vars file. So I've been tinkering with that too.

Right now when I go to create a new product, nothing after "Pages:" is diplayed.

any help, ideas or suggestions would be great!

thanks!

june

9 Nov 2005, 2:31 PM
#50
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

Ok, so I found some code that doesn't deal with all the language stuff and that seem to do the trick:

<?php echo zen_draw_input_field('pages_id', $pInfo->products_id, 
zen_set_field_length(TABLE_PRODUCT_PRINT_EXTRA, 'pages_id')); ?>

Having our site in another language is way down the road, so I guess this will do for now. Everything looks good on the admin end now. But I still have to smooth things out on the users end.

-june

9 Nov 2005, 5:25 PM
#51
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

Ok, things are definitely getting stored in the database table but they are not being displayed on the individual product page.

I've added this to the template page:

<?php echo ((SHOW_PRODUCT_PRINT_INFO_KEY_FEATURES == '1' and !empty($key_features)) ? TEXT_PRODUCT_KEY_FEATURES . $key_features : ''); ?>

The end result shows:

Key Features: Object

"Key Features:" is correct but "Object" isn't. Instead I should be seeing the list of features I typed in.

Any ideas? I'm guessing I have something wrong in the main_template_vars file, since there is code for "$key_features" there too.

any help would be great!

thanks!

june

10 Nov 2005, 8:36 AM
#52
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Adding New Product_types

where do you define $key_features?
Chances are it's simply the object used to run a SQL SELECT statement? If so, you need to extract the data it SELECTed in order to display the real data.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2005, 5:56 PM
#53
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

here is where $key_features appears:

collect_info.php

elseif (zen_not_null($_POST)) {
   $pInfo->objectInfo($_POST);
   $products_name = $_POST['products_name'];
   $products_description = $_POST['products_description'];
   $products_url = $_POST['products_url'];
  $key_features = $_POST['key_features_id'];
  $author = $_POST['author_id'];
  $isbn = $_POST['isbn_id'];
  $pages = $_POST['pages_id'];
  }
 $key_features_array = array(array('id' => '', 'text' => TEXT_NONE));
  $key_features = $db->Execute("select products_id, key_features_id
                  from " . TABLE_PRODUCT_PRINT_EXTRA . " order by key_features_id");
  while (!$key_features->EOF) {
   $key_features_array[] = array('id' => $key_features->fields['products_id'],
                   'text' => $key_features->fields['key_features_id']);
   $key_features->MoveNext();

main_template_vars.php

 $sql = "select * from " . TABLE_PRODUCT_PRINT_EXTRA . "
      where key_features_id = '" . $print_extras->fields['key_features_id'] . "'";

  $key_features = $db->Execute($sql);
 $key_features = $product_info->fields['key_features_id'];

tpl_product_print_info_display.php

<h2 class="pageHeadingP">Key Features</h2>
  <p><?php echo ((SHOW_PRODUCT_PRINT_INFO_KEY_FEATURES == '1' and !empty($key_features)) ? TEXT_PRODUCT_KEY_FEATURES . $key_features : ''); ?></p>

And I'm not sure what I've done but "Key Features:" is no longer displaying either.

Any idea of where I might have gone wrong? If you need more context for the code, just let me know. I'm not sure if any of the code above is where the info is actually "extracted." I'm still learning php.

thanks!

june

11 Nov 2005, 3:43 AM
#54
thunderbird avatar

thunderbird

New Zenner

Join Date:
Sep 2005
Posts:
38
Plugin Contributions:
0

Re: Adding New Product_types

Darkwander,

Where you able to see how to change the fields that I had mentionsed?

Thanks

11 Nov 2005, 1:09 PM
#55
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

ok, so I'm trying to narrow down my problem. below is some code from tpl_product_print_info_display:

<?php echo (( SHOW_PRODUCT_RRINT_INFO_AUTHOR == '1' and !empty($author)) ? TEXT_PRODUCT_AUTHOR . $author : 'Something'); ?>

Right now "something" is the only thing that displays. So that means:

  1. SHOW_PRODUCT_RRINT_INFO_AUTHOR is turned on
  2. $author isn't empty
  3. the broken pieces of code include TEXT_PRODUCT_AUTHOR and $author.

I'm kind of confused as to why it is not displaying either of those things in #3.

Any could someone tell me what "?" in the middle means?

thanks!

june

11 Nov 2005, 1:29 PM
#56
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

Sorry, most the stuff in my last post is wrong! I just learned that my code contains a compact if statement. I'm not use to writing if statements that way. So, "something" is displaying because one or both of the determing factors are false.

I isolated each determining factor and they are both false. eek!

When I echo $author alone it displays a "0"
When I echo TEXT_PRODUCT_AUTHOR alone it displays "Author:" (which is correct)

well, back to the drawing board. heh.

-june

11 Nov 2005, 1:51 PM
#57
june avatar

june

Zen Follower

Join Date:
Sep 2005
Posts:
80
Plugin Contributions:
0

Re: Adding New Product_types

I just discovered that its outputting the info for the first record in the table, no matter what product you are looking at. The first product in the table was a listing that was mostly empty...hence the "0"

I'll let you know when I figure out the rest of the problem. ;)

thanks!

june

20 Nov 2005, 7:52 PM
#58
thunderbird avatar

thunderbird

New Zenner

Join Date:
Sep 2005
Posts:
38
Plugin Contributions:
0

Re: Adding New Product_types

I am trying to take out the "Units in Stock" out of my product pages. IN the Product - General type this can easly be done with the edit layout feature in the Admin section. However, there is not such features for the General- Book product type.

Is there a way to put all the layout attributes in the product - Book section or how do I take out the "Units in Stock" from showing up?

Thanks

20 Nov 2005, 7:55 PM
#59
thunderbird avatar

thunderbird

New Zenner

Join Date:
Sep 2005
Posts:
38
Plugin Contributions:
0

Re: Adding New Product_types

Nevermind. I just figured out that that changing the main attributed from the Product - General carries over to the sub Categories.

Sorry for the post

20 Nov 2005, 8:09 PM
#60
ajeh avatar

ajeh

Oba-san

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

Re: Adding New Product_types

Actually ... that is dependant on how a Product Type is designed.

A 100% true Product Type would have all of the settings that you see in Product General ... this allows the settings to be 100% unique per product type so you can configure all the little nuances of a Product Type separately from another Product Typs ... :)

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!