Jump to content

Archived

This topic is now archived and is closed to further replies.

screwface

one product; multiple quantity categories

Recommended Posts

greetings,

 

Ex.) if i have 1 style of t-shirt in 4 different colors and 3 different sizes how can i give each color and size a quantity description without creating 12 seperate products (one for each color and respective size)?

 

i need help? anyone?

_________________

rebelsoul loves you but the Most High loves you more


rebelsoul loves you but the Most High loves you more

Share this post


Link to post
Share on other sites

Attributes section. Add attributes sorter and copier for easy addition of attributes to lots of products.


[no external urls in signatures please, kthanks]

Share this post


Link to post
Share on other sites
Attributes section. Add attributes sorter and copier for easy addition of attributes to lots of products.

 

You are just trying to make me type even faster, aren't you? :shock:

Share this post


Link to post
Share on other sites

LOL, yup yup :)


[no external urls in signatures please, kthanks]

Share this post


Link to post
Share on other sites

thanks for replying guys, but i had the same question as (Jazz man Jay)-THE LIMIT OF OSC or the Product-Attribute-Stock problem.

 

yes OSC is great and I really enjoy this program, but I want to make a clothes-outlet store and... I've reached the limit of OSC.

How ?

Here an example:

You got an item (T-Shirt) in 2 possible colors (red,blue) in 3 possible sizes (S, M, L) and on stock you have:

 

BLUE_sizeS=1 piece,

BLUE_sizeM=2 pieces,

BLUE_sizeL=3 piece.

 

RED_sizeS=4 piece,

RED_sizeM=5 pieces,

RED_sizeL=6 piece.

 

Using OSC you can not add different stock per options, using contributions, if one of the stock of an attribute is egal 0, the whole Item is vanishing in OSC nirvana

 

mybe i worded my question wrong? is your soulution still the same:

 

Attributes section. Add attributes sorter and copier for easy addition of attributes to lots of products.


rebelsoul loves you but the Most High loves you more

Share this post


Link to post
Share on other sites

At this time, osCommerce does not have a stock option to manage attributes in the way you are wanting.

 

There is a contribution that may help you for this.

 

At some point, I hope to address this issue. But so far, I have not had a lot of fun with it, nor the time to devote to this that is needed.

 

I don't want to re-write the world, nor do I want the Store Owner to have a lot of work or thinking involved in trying to manage stock based on attributes either.

Share this post


Link to post
Share on other sites

We had the same problem because we have cassette, CD, and VHS of the same things. Originally I handled it with the options, but found I prefer having separate products for inventory and for clarity to the customer. It's easy to do the multiple products because you can use copy in the product editor and then change the name a little, like "T-shirt<br>Red - Small". Then I had to hack new_products.php, so that it wouldn't show multiple products with similar names. Also in the product info page, I put a link to a search that you might call "Find this in other colors and sizes".

 

You can see what I mean at http://www.arbucklechurch.org/catalog


In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Share this post


Link to post
Share on other sites
We had the same problem because we have cassette, CD, and VHS of the same things. Originally I handled it with the options, but found I prefer having separate products for inventory and for clarity to the customer. It's easy to do the multiple products because you can use copy in the product editor and then change the name a little, like "T-shirt<br>Red - Small". Then I had to hack new_products.php, so that it wouldn't show multiple products with similar names.

I've come to the same conclusion. It also means that its easier to find with a search, since atributes dont show up on a search. I'd be interested to see your hack code.

 

Also in the product info page, I put a link to a search that you might call "Find this in other colors and sizes".

 

You can see what I mean athttp://www.arbucklechurch.org/catalog

I get round this problem by listing each type of product as a subcategory, eg Bugs Set with products listed as Bugs Set -small, Bugs Set -medium, Bugs Set-large, etc.

The contributions that are pre installed on the loaded5 version mean that the subcategory listing has buy now buttons. :-)

 

Only problems I have with this arrangement is you cant enlarge the pic from the subcat without going into the individual product listing.


I've had 3 children.........how hard can this be???

Share this post


Link to post
Share on other sites
I'd be interested to see your hack code.

Here it is. starting from line 20 of includes/modules/new_products.php in 2.2MS1:

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc");

 } else {

   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc");

 }



 $row = 0;

 $col = 0;

 $info_box_contents = array();

 $new_products_short_name = array();

 while ( ($new_products = tep_db_fetch_array($new_products_query) ) && ( ( $row * 3 + $col ) < MAX_DISPLAY_NEW_PRODUCTS ) ) {

   $new_products['products_name'] = tep_get_products_name($new_products['products_id']);

   $short_name = $new_products['products_name'];

   $short_pos = strpos( $short_name, '<' );

   if ( $short_pos > 0 )

   {

       $short_name = substr( $short_name, 0, $short_pos );

   }

   $short_name_for_image = $short_name;

   $short_pos = strpos( $short_name, '-' );

   if ( $short_pos > 0 )

   {

       $short_name = substr( $short_name, 0, $short_pos );

   }

   $new_short_name = 1;

   foreach( $new_products_short_name as $column )

   {

       foreach ( $column as $value )

       {

           if ( $short_name == $value )

           {

               $new_short_name = 0;

           }

       }

   }

   if ( ( $new_short_name == 1 ) && ( strstr( $short_name, 'Donation' ) == false ) )

   {

       $new_products_short_name[$row][$col] = $short_name;

       $info_box_contents[$row][$col] = array('align' => 'center',

                                              'params' => 'class="smallText" width="33%" valign="top"',

                                              'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $short_name_for_image, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));



       $col ++;

       if ($col > 2) {

         $col = 0;

         $row ++;

       }

   }

 }

A little explanation may help. Our products all have a <br> in the middle of the name so that the media format (CD,VHS,etc) will go on the second line. Also, we have products with multiple volumes that always have a - between the name and the volume number.

Since I don't show all the products that I get from the database I took limit " . MAX_DISPLAY_NEW_PRODUCTS off the end of the call to tep_db_query to make sure I got enough products from the database. On a bigger store it might be better to limit to 5 or 10 times MAX_DISPLAY_NEW_PRODUCTS. Then in the while loop, ( $row * 3 + $col ) < MAX_DISPLAY_NEW_PRODUCTS limits the number of products displayed. $new_products_short_name is an array to store the shortened names of products that are going to be displayed (the part after < or - chopped off). Each $new_products['product_name'] is copied into $short_name and then if a < or - is found, $short_name is shortened. Then I check to see if $short_name is already in the list $new_products_short_name and $new_short_name indicates whether it is or not and should probably be a boolean variable instead of an integer if you want to be stylish. If $short_name is new, the product is displayed. I also check that the product doesn't have 'Donation' in the name because we don't want to push for donations, but are able to accept them. I also added $short_name_for_image last night so that the name with the part after <br> removed, but not the part after - removed, so that the flyover (yellow box thing) doesn't show the stuff after <br>.


In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Share this post


Link to post
Share on other sites

ok, I just noticed that my "buy now" buttons are gone... is there any way to get them back into the new products section?

Share this post


Link to post
Share on other sites

I have the script for the 'buy now' option, I just haven't been able to combine the two successfully, it it can be done that is.. lol

 

here is the script:

 

<?php

 $info_box_contents = array();

 $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price,

p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

 } else {

   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

 }

 

 $info_box_contents = array();

 $row = 0;

 $col = 0;

 while ($new_products = tep_db_fetch_array($new_products_query)) {

   $new_products['products_name'] = tep_get_products_name($new_products['products_id']);

   $info_box_contents[$row][$col] = array('align' => 'center',

                                          'params' => 'class="smallText" width="33%" valign="top"',

                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .

$new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .

$new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'],

tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW) . '</a>');

 

   $col ++;

   if ($col > 2) {

     $col = 0;

     $row ++;

   }

 }

 new contentBox($info_box_contents);

?>

Share this post


Link to post
Share on other sites

Hi!

 

I have added the lines to my includes/modules/new_products.php

 

I made 2 products named

T-shirt<br>Red-L

T-shirt<br>Red-XL

 

When i look at my first page it says under the "new products for may"

T-shirt

Red-LX

$12.09

And under "Whats new"

T-shirt

Red-L

$12.09

 

 

And when I list the "whats new" products it shows:

T-shirt

Red-LX

Date Added: Friday 02 May, 2003

Manufacturer:

 

Price: $12.09

 

T-shirt

Red-L

Date Added: Friday 02 May, 2003

Manufacturer:

 

Price: $12.09

 

***********

Is this correct?

 

And how do i get the "Find XXXX in other formats" under each product?

 

Sorry if I am stupid. :roll:

 

 

Thanks in advance for all your help.

 

/Anneli

Share this post


Link to post
Share on other sites

I did it like this

    echo '<style>' . "n";

   echo 'a:link{color:#0000FF; Text-decoration: underline}' . "n";

   echo 'a:visited{color:#400080; Text-decoration: underline}' . "n";

   echo 'a:hover{color:#FF0000; text-decoration: underline}' . "n";

   echo '</style>' . "n";



   $short_pos = strpos( $product_info['products_name'], '<' );

   if ( $short_pos > 0 )

   {

       $short_name = substr( $product_info['products_name'], 0, $short_pos );

       $search_name = str_replace( ' ', '+', $short_name );

       echo '<a href=advanced_search_result.php?keywords=' . $search_name. '>Find <i>' . $short_name . '</i> in other formats</a><br>' . "n";

   }

The first part is to make the links blue so you can see them. All of my products have <br> in the middle of them. The part before <br> tells the common product name, the part after the <br> tells the option on the product (in my case CD,VHS,etc). This code gets the part of the product name before the <br> and searches for it using the normal osCommerce search.


In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Share this post


Link to post
Share on other sites

I suppose it would help to mention that the code goes in product_info.php

        echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

       echo '</td></tr>';

     }

     echo '</table>';

   }



// INSERT CODE HERE



?>

       </td>

     </tr>

<?php

   $reviews = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'");


In olden times the men were made of iron and the ships were made of wood; now it's the other way around. :wink:

Share this post


Link to post
Share on other sites

Mm,thanks :D

 

Just to be really hopeless, i have 2 language in my page. And it shows the english text (on both pages). :(

 

Can I use some kind of tep function to display diffrent text dependning on the language?

 

Define something in english.php and svenska.php?

 

/Anneli

Share this post


Link to post
Share on other sites

×