Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute as Images - 2.2MS2


fiscus

Recommended Posts

Has anyone got a Contribution that displays attributes as images for 2.2MS2.

 

I know there is one for MS1 but it doesn;t work for 2.2. I am surpirsed that one has been released yet? Is anyone working on one?

 

Thanks

Link to comment
Share on other sites

Apparently no one can and bumping is annoying and not allowed.

 

Adding more details is an acceptable way to bring your topic back to the top of the forums.

 

As far as your question, these are all volunteers and if the person that wrote it for ms1 isn't interested in updating it, then it may be a while before someon else has time to do it.

 

You can always post a request in the commercial forum and see if you get any bites (I doubt it, but hey ya never know).

[no external urls in signatures please, kthanks]

Link to comment
Share on other sites

Well, it was hard enough to get working on later snapshots of 2.2MS1.

 

I did get it working after a fashion on my wife's site, but I don't think it would suitable for general relase as it was before I learnt how to do things properly and there was a serious amount of dodgy hacking to get it working in the languages department.

 

No promises, but I'm doing an MS2 store at the moment and putting just about every useful mod known to man on it. It would seem a good time to rewrite this one (or perhaps start from scratch!), so I may have something in a week or two. If so, I will obviously release it as a contrib.

 

Watch this space.....

 

Cheers,

 

 

 

Mark.

P.S. If anyone else is working in a similar vein, let me know as we could save ourselves some time :idea:

Link to comment
Share on other sites

Loxly: - thanks for the info and I understand about the bumping - point noted :-)

 

equilla: that would be awsome if you were to on that. I really see it as a usefull mod - so all the best and hopefully we may see another post from you shortly.

Link to comment
Share on other sites

No Problems. Started having a look at it today on the MS2 build I have on my laptop (useful for productive work during lunchtimes of my day job!).

 

I've got the catalog side practically finished now, with only 3 lines needing to be added to product_info.php - the rest of the functionality being in a new file.

 

I shall be getting on with the (more complicated) admin side from tomorrow onwards, so should have something towards the end of the week. When it's nearing completion I'll drop you a line as it's always useful to have another pair of eyes to spot obvious omissions before releasing it.

 

Cheers,

 

 

 

Mark

Link to comment
Share on other sites

Hi All,

 

Well after a night of swearing at my PC I now have a rough-and-ready working version ready for peer reviewing. If you PM me with your e-mail addresses, I'll send you links to demo with admin and catalog now up and running.

 

Any comments on what needs to be added/changed, etc, can then be worked in over the next couple of days, whilst I'm tidying up the code.

 

Just to summarise what I have right now though. Basically, this has been started from scratch and has no shred of the old Options as Images code in it. I have aimed for simplicity as I believe the old contrib fell into disrepair quickly as it tried to go beyond what the name of the contrib implied.

 

There are many other contribs out there that allow you to manage the attributes themselves, so I have made this contrib stick to doing "what it says on the tin".

 

So, this contrib allows you to upload a thumbnail image and tag it to the relevant attribute option value. "Click to Enlarge" functionality in the catalog has not been implemented yet, but I will put this in before release.

 

Configuration-wise, there are currently 2 options:

1. Enable / Disable Options as Images

2. Set the number of images per row when presented in the catalog

 

To this I will also add Image Height and Width settings.

 

Anyway, I'd be very interested in hearing what else I need to do in order to make this work for you.

 

Regards,

 

 

 

 

Mark

Link to comment
Share on other sites

Sounds brilliant equliia!!!

 

I have PM'd you my email address to test it all!

 

I have no need for 'click to enlarge' so maybe that could be an enable/disable in admin (I am showing fabric swatches for colour reference - there is no need to enlarge these) but I understand that other will want this.

 

I am happy to comment / edit the code for my no pop up needs but an admin enable/disable would be ideal.

 

Looking forward to it.

Link to comment
Share on other sites

  • 5 weeks later...

Mark,

 

Let's start over... :lol:

 

I did get this to work and it is excellent! I do have a question though.

 

The catalog/images folder is chmod 777 and also the catalog/images/options folder is 777 which gave me the broken images.

 

I, then, chmod each image inside the catalog/images/options folder to 777 and the images started showing up and working.

 

Do all the images inside the folder have to be changed? They all were 644 inside the options 777 folder.

 

Also, it looks like once you put the images in under the option names that you cannot remove them from the admin. Is this correct?

 

================================================

 

PREVIOUS POST:

 

I emailed you an image of the admin section of the catalog/options but thought I would post also.

 

xxxxI found some broken images already in several of the options. If I click catalog/options on color or size there are no images. How do you put images in the attributes? (got this figured out...add the value!)

 

The images are there but are broken.

 

I put an image in the images/options folder and uploaded. The options folder is chmod 777.

 

If I tried to edit one of those broken images I get this error:

Warning: copy(/home/designus/public_html/family/images/options/arrow_green.gif): failed to open stream: Permission denied in /home/designus/public_html/family/admin/options_images.php on line 31

unable to copy /tmp/phpkzOlVs to location /home/designus/public_html/family/images/options/arrow_green.gif

I tried doing it this way:

C:\Documents and Settings\user\My Documents\WebDesign\+stores\designhosting.us\family\images\options\arrow_green.gif

 

and this way:

C:\Documents and Settings\user\My Documents\WebDesign\+stores\designhosting.us\family\images\options/arrow_green.gif

 

If I right click on the broken image the path says this:

http://www.designhosting.us/family/images//options/

 

Is there a path wrong someplace?

Edited by modom
Link to comment
Share on other sites

  • 1 year later...

Mark - I just wanted to say that I installed Options as Images for MS2 today, and it's wonderful. I spent the better part of the past two days trying to get the original Options as Images (MS1) going, and it was a bear. I learned a lot about OSC innards, but there was a lot to fix, both code-wise and in terms of aesthetics, and I wasn't there yet. (I didn't know there was a version for MS2 until Wendy James mentioned it in another thread.)

 

So I am doubly enthusiastic and downright lyrical about your version, because it's WONDERFUL! Many thanks.

 

Regards,

 

--Grayson

Grayson Morris

Link to comment
Share on other sites

  • 1 month later...

This is a great contribution and it's exactly what I need! But I'm having troubles getting it to work with another contrib I have installed- the Options Text mod: http://www.oscommerce.com/community/contri...ch,options+text

 

They both mess with the same area of code, and I'm not a PHP guru by any stretch of the mind. Here is the code section (with both mods installed)

 

<?php

if (OPTIONS_AS_IMAGES_ENABLED == 'false'){

   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
	 //clr 030714 update query to pull option_type
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
   //clr 030714 add case statement to check option type
       switch ($products_options_name['products_options_type']) {
         case PRODUCTS_OPTIONS_TYPE_TEXT:
           //CLR 030714 Add logic for text option
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
           $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];
           if ($products_attribs_array['options_values_price'] != '0') {
             $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
           }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo $tmp_html;  ?></td>
           </tr>
<?php
           break;
	 
         case PRODUCTS_OPTIONS_TYPE_TEXTAREA:
           //CLR 030714 Add logic for text option
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
 $tmp_html = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
          onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
          onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
          wrap="soft" 
          name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
          rows=5 
          id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
          value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>
     <div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>
     <script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?>	<!-- DDB - 041031 - Form Field Progress Bar //-->
           <tr>
<?php
           if ($products_attribs_array['options_values_price'] != '0') {
?>
             <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>
<?php       } else {
?>
             <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>
<?php        }
?>
             <td class="main"><?php echo $tmp_html;  ?></td>
           </tr>
<?php
           break;
	 
         case PRODUCTS_OPTIONS_TYPE_RADIO:
           //CLR 030714 Add logic for radio buttons
           $tmp_html = '<table>';
           $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
           $checked = true;
           while ($products_options_array = tep_db_fetch_array($products_options_query)) {
             $tmp_html .= '<tr><td class="main">';
             $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
             $checked = false;
             $tmp_html .= $products_options_array['products_options_values_name'];
             $tmp_html .=$products_options_name['products_options_comment'];
             if ($products_options_array['options_values_price'] != '0') {
               $tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
             }
             $tmp_html .= '</tr></td>';
           }
           $tmp_html .= '</table>';
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo $tmp_html;  ?></td>
           </tr>
<?php
           break;
         case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
           //CLR 030714 Add logic for checkboxes
           $products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
           $products_attribs_array = tep_db_fetch_array($products_attribs_query);
           echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';
           echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);
           echo $products_options_name['products_options_comment'];
           if ($products_attribs_array['options_values_price'] != '0') {
             echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
           }
           echo '</td></tr>';
           break;
         default:
           //clr 030714 default is select list
           //clr 030714 reset selected_attribute variable
           $selected_attribute = false;
         $products_options_array = array();
         $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
         while ($products_options = tep_db_fetch_array($products_options_query)) {
           $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
           if ($products_options['options_values_price'] != '0') {
             $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
           }
         }

         if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
           $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
         } else {
           $selected_attribute = false;
         }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . $products_options_name['products_options_comment'];  ?></td>
           </tr>
<?php
       }  //clr 030714 end switch
     } //clr 030714 end while
?>
         </table>
<?php
   } //clr 030714 end if
//Options as Images. Add the curly bracket as shown on the next line
}
?>

<?php
//Options as Images. This whole php clause needs to be added
if (OPTIONS_AS_IMAGES_ENABLED == 'true') include ('options_images.php'); 
?>

 

What is happening is that the images options are working, but the option I have set as 'Text' is coming up as a select box with an option 'text', rather than a text box (before I installed the images mod, it was coming up as a text box)

 

Here's a link: http://www.inksplashdesigns.net/shop/produ...027353a09eb903a

 

Any ideas? :)

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...