Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Product Attributes helper

Product Attributes helper

Locked

Views: 1,910

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
18 Jul 2007, 8:58 PM
#1
bvrettski avatar

bvrettski

New Zenner

Join Date:
Jul 2007
Posts:
33
Plugin Contributions:
0

Product Attributes helper

My client has a variety of product variants and we want to explain them so customers can make an informed choice.

For example their log beds come in natural, aspen, hand peeled and skip peeled styles.

We already have a page explaining the differences and showing little thumbnails but we would like to either show these off on each page where the customer would be shopping or better yet give them a link to a little popup type chart explaining it.

Either solution..a link back to the page or a link to the popup would need to be available on each page so I'm looking for recommendations and directions on what to edit and where it is.

Thanks
Brett

www.lincolnlogsfurniture/shop/

18 Jul 2007, 9:40 PM
#2
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Product Attributes helper

A quick solution would be to simply put target="_whole" in the existing link ( I assume you already have a link from the Zencart product page to the "page explaining the difference".)

In otherwords, add target="_whole" to the code like this:

*<a href="http://lincolnlogsfurniture/[yourpage]" target="_whole">*more info</a>.

The _whole target assures that when the user clicks the link that it opens in a whole new window. When the window is later closed, the ZenCart is page is still displayed from underneath
.
If you want to do it in a true popup window, there are many references to creating popups in java. Just do a Google on popup scripts or popup java. They are fairly easy to add to your zencart product pages. In either case, a link back to your product page is not really necessary as the product page remains in the background until the viewer closes the new window.

Ron

19 Jul 2007, 1:21 AM
#3
bvrettski avatar

bvrettski

New Zenner

Join Date:
Jul 2007
Posts:
33
Plugin Contributions:
0

Re: Product Attributes helper

What php files would I need to add the link to to get it to show with each product?

No I dont have a link yet....

It would be better if it came up as a small boarderless window..like a popup but sized smaller as it will be like a chart.

19 Jul 2007, 1:29 PM
#4
bvrettski avatar

bvrettski

New Zenner

Join Date:
Jul 2007
Posts:
33
Plugin Contributions:
0

Re: Product Attributes helper

I've been giving this some thought and my favorite soultion would be a row of thumbnails with small text underneath and mouse overs which explain the item.

I know its more complicated but more stylish too.

If it gets too mess y I'll go another way.

Things I think I'd need to know.

1.Where would the code need to go to show up on each product page

  1. code for writting mouse overs and the location where this code would be if not in the same location as the products.

Thanks

20 Jul 2007, 7:36 AM
#5
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,806
Plugin Contributions:
15

Re: Product Attributes helper

You can simply change your dropdown attributes to a selection from an image. http://www.gomagnetic.com/index.php?main_page=product_info&products_id=119 is an example of how. Don't forget that you need to have a "For Display Only" Default item so the customer has to select the option they want.

24 Jul 2007, 6:45 PM
#6
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Product Attributes helper

to DBLTOE:
Wow, that's some heavy duty use of attributes! Great job! Anyone who wants to the see the real power of this Zencart feature, check his website in post #5

8 Jan 2009, 10:38 AM
#7
pilot avatar

pilot

New Zenner

Join Date:
Apr 2005
Posts:
55
Plugin Contributions:
0

Re: Product Attributes helper

Thats a great site dbltoe,

You have created a popup on your anklet size (guidelines) that is exactly what I am trying to create.

There is the line of text that you can add in admin attributes, but being new to this I hoped you would expand the method of how it was done to add a link like yours ?

Really appreciate your help in advance.

8 Jan 2009, 7:35 PM
#8
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,806
Plugin Contributions:
15

Re: Product Attributes helper

Can't take credit for that portion. Most of the backend work was done by haredo (Mark). It was his first site and I prodded, he researched.

I guess we need to publish that as a mod.

When the product is displayed, it uses the tpl_product_info_display.php to display the product. If you have attributes with the item, the tpl_modules_attributes.php file is called.

You put an if in the tpl for attributes, use JavaScript to pop-up the window, add some files to the extra-datafiles folder, add a couple of folders with some files, (THEN A MIRACLE HAPPENS), and you're done!:smartalec:

The code in the tpl_modules_attributes.php looks like ```php

<div id="productAttributes"> <?php if ($zv_display_select_option > 0) { ?> <h3 id="attribsOptionsText"><?php echo TEXT_PRODUCT_OPTIONS; ?></h3> <?php } // show please select unless all are readonly ?> <?php for($i=0;$i<sizeof($options_name);$i++) { ?> <?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') { ?> <h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3> <?php }

if (preg_match("/anklet/i", $options_name[$i]))
{
$guideLink = '<a href="javascript:popupWindowPrice(\'' . zen_href_link(FILENAME_POPUP_ASZLNGTH) . '\')">(<u>Guidelines</u>)</a>';

}
else
$guideLink = null;
?>
The file popup_aszlnth_filenames.php goes in the /includes/extra_datafiles folder and looks likephp

<?php // ASZLNGTH Filename Define define('FILENAME_POPUP_ASZLNGTH', 'popup_aszlngth'); ?>

A folder called popup_aszlngth goes under includes/modules/pages and contains the files header_php.php php

<?php /** * Pop up attribute help * */ $_SESSION['navigation']->remove_current_page(); require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); ?>

along with the header_php.php file, there needs to be a jscript_main.php file that looks likephp

<?php // window resizing for aszlngth ?> <script language="javascript" type="text/javascript"><!-- var i=0; function resize() { if (navigator.appName == 'Netscape') i=40; if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i); self.focus(); } //--></script>

There also needs to be a folder named pop-up_azlngth in the custom template folder (includes/templates/gomag/popup_aszlngth) that contains the tpl_main_page.php file which looks likephp

<?php /** * tpl_main_page.php * * Main page to display the aszlngth pop-up data */ ?> <body id="popupASZLNGTH"> <h1><?php echo HEADING_ASZLNGTH ?></h1> <div id="ankletSize"><?php echo TEXT_ASZLNGTH1 ?></div> <div><?php echo TEXT_ASZLNGTH2 ?></div> <div><?php echo '<a href="javascript:window.close()">' . TEXT_CLOSE_ASZLNGTH_WINDOW . '</a>'; ?></div> </body> ```There may be something I've left out and I'll get Mark to review. This whole "magic" is loosely based on the existing cvv pop-up.

As I always say to Mark, "Necessity is NOT the Mother of invention; laziness IS!" Or, as a friend of mine would say, "We RESEARCHED the cvv pop-up."

8 Jan 2009, 7:45 PM
#9
pilot avatar

pilot

New Zenner

Join Date:
Apr 2005
Posts:
55
Plugin Contributions:
0

Re: Product Attributes helper

Thank you so much for taking the time to explain this, I will get on with this right away.

Superb Mod !

8 Jan 2009, 8:12 PM
#10
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,806
Plugin Contributions:
15

Re: Product Attributes helper

Keep in mind that I'm old and have a bad case of CRS.

Use this only on a test site till I confirm it all.

8 Jan 2009, 10:35 PM
#11
pilot avatar

pilot

New Zenner

Join Date:
Apr 2005
Posts:
55
Plugin Contributions:
0

Re: Product Attributes helper

Had a go at it.

I have tried this on my test shop and it breaks the attributes only so they do not appear. I replaced the unchanged tpl_modules_attributes.php and the attributes reappear.

looking at the tpl_modules_attributes.php with my inexperienced eyes I noticed this piece:

if (preg_match("/anklet/i", $options_name[$i])) does the /anklet/ refer to the ankle attribute on your site?

The other question is the last instruction

(There also needs to be a folder named pop-up_azlngth in the custom template folder (includes/templates/gomag/popup_aszlngth) that contains the tpl_main_page.php file which looks like )

The folder is called pop-up_azlngth and it is referred in the path name as popup_aszlngth, just a - missing ?

If I may repeat the procedure to make sure I understood it correctly.

1 I modified tpl_modules_attributes.php with supplied code.

2 Created a file called popup_aszlnth_filenames.php and dropped in /includes/extra_datafiles folder

3 Created a directory called popup_aszlngth and created two new files header_php.php and jscript_main.php and put in includes/modules/pages

4 Created two new directories gomag and pop-up_azlngth and created the file tpl_main_page.php and arranged them as this includes/templates/gomag/pop-up_azlngth/tpl_main_page.php

really appreciate your help, it would be really nice to get this running. thanks

8 Jan 2009, 10:47 PM
#12
pilot avatar

pilot

New Zenner

Join Date:
Apr 2005
Posts:
55
Plugin Contributions:
0

Re: Product Attributes helper

forgot to mention I am using version 1.3.8A think my old age is creeping up fast !!!!

8 Jan 2009, 11:44 PM
#13
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,806
Plugin Contributions:
15

Re: Product Attributes helper

if (preg_match("/anklet/i", $options_name[$i])) does the /anklet/ refer to the ankle attribute on your site?

The other question is the last instruction

(There also needs to be a folder named pop-up_azlngth in the custom template folder (includes/templates/gomag/popup_aszlngth) that contains the tpl_main_page.php file which looks like )

The folder is called pop-up_azlngth and it is referred in the path name as popup_aszlngth, just a - missing ?
Yes, on the anklet. It's actually the first work in the Option Name for the attribute. Note that lowercase is fine to use.

The popup problem is a program I use because my keyboard is lousy at typing.:censored:
All instances of pop-up should be popup instead.

Can't believe how hard it was to wrestle that :censored: spell checker down to the mat.

Lastly, > includes/templates/gomag/popup_aszlngthshould be "massaged" to reflect your custom folder's name versus the gomag.

And, in case you're wondering, aszlngth stands for "anklet size length"