Author Topic: Custom Attributes Extended 2.1 [Hack]  (Read 526877 times)

dubey

  • Beginner
  • *
  • Posts: 21
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #15 on: May 14, 2007, 02:49:48 am »
Sorry for the basic html lesson, but how do I populate a custom attribute field from a pop up link? 

This is the the html of the link:


<script src="301a.js" type="text/javascript"></script>

</head>


<body>
<div id="colorpicker301" class="colorpicker301"></div>
Color: <input type="button" onclick="showColorGrid3('input_field_1','sample_1');" value="...">&nbsp;<input type="text" ID="input_field_1" size="9" value="">&nbsp;<input type="text" ID="sample_1" size="1" value="">

How do I get this value into a custom attribute text box.

If I could work this out, I could do all sorts of stuff, like use a form value to populate a donation box?


barnett

  • Jr. Member
  • **
  • Posts: 92
    • Contemplate Design
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #16 on: May 14, 2007, 04:36:39 am »
@dubey

This is basically what you want.
1) upload the 301a.js file to /includes/js/swatch/ folder

2) open the ps_product_custom_type.php file and paste this code at the end:
Code: [Select]
/***************************************************
 *
 * Swatch element class
 * The class is is used to manage the product custom attribute type.
 *
***************************************************/
class ps_product_custom_type_swatch {
var $classname = "ps_product_custom_type_swatch";

    /**
* Outputs HTML for Custom Attribute
*/
function customTypeHTML($field=array()) {
global $mainframe, $mosConfig_live_site;
    $html = "";
$titlevar = trim($field['attr_pagevar']);
$attr_value = explode('|',$field['attr_value']);
$default_date = $attr_value[0];
$date_type = $attr_value[1];

$mainframe->addCustomHeadTag( '<script type="text/javascript" src="'. $mosConfig_live_site . '/includes/js/swatch/301a.js"></script>' );

if(!$field['attr_post_value']){
            $html .= "<div id='colorpicker301' class='colorpicker301'></div>";
$html .= "<input type=\"button\" value=\"Select Color\" onclick=\"showColorGrid3('rgb_id','sample_id');\" >";
$html .= "<input class=\"inputbox\" type=\"text\" name=\"".$titlevar."\" value=\"".$default_date."\" size=\"10\" ID=\"rgb_id\">";
$html .= "<input class=\"inputbox\" type=\"text\" size=\"2\" ID=\"sample_id\">";
} else {
            $html .= "<div id='colorpicker301' class='colorpicker301'></div>";
$html .= "<input type=\"button\" value=\"Select Color\" onclick=\"showColorGrid3('rgb_id','sample_id');\" >";
$html .= "<input class=\"inputbox\" type=\"text\" name=\"".$titlevar."\" value=\"".trim($field['attr_post_value'])."\" size=\"10\" ID=\"rgb_id\">";
$html .= "<input class=\"inputbox\" type=\"text\" size=\"2\" ID=\"sample_id\">";
}

return $html;
}

/**
* Outputs Secure Value for Custom Attribute
*/
function customTypeSecureValue($field=array()) {
return '';
}

/**
* Outputs & Processes the submitted data for Custom Attribute to Cart
*/
function customTypeProcess($value, $field=array()) {
return $value;
}

}

save the file.

3) Next enter in the swatch like this into the back end:

Color(swatch)(tip here|title-below)();

that should work.
-barnett

dubey

  • Beginner
  • *
  • Posts: 21
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #17 on: May 14, 2007, 04:46:48 am »
Yes, that works perfectly. A million thank yous.

Christian Bach

  • Beginner
  • *
  • Posts: 29
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #18 on: May 14, 2007, 08:39:42 am »
your code should be this:

Code: [Select]
Skrifttyper(radio)(|)(Enkeltblok|/images/stories/gravering/eb.gif,Dobbeltblok|/images/stories/gravering/db.gif,Enkeltskriveskrift|/images/stories/gravering/es.gif,Dobbeltskriveskrift|/images/stories/gravering/ds.gif);
Gravering Linie 1(text)(|)(|1.00|char_nospace);
Gravering Linie 2(text)(|)(|1.00|char_nospace);
Gravering Linie 3(text)(|)(|1.00|char_nospace);

you had an extra () making four in all instead of three.  Hope that helps.
-barnett

Hi again,

Thanks for your reply.

I have removed the extra () in the code, and it does not work. It still tells me that I need to select a variant. It seems that I can't add products to the basket because of the radiobuttons:
Code: [Select]
Skrifttyper(radio)(|)(Enkeltblok|/images/stories/gravering/eb.gif,Dobbeltblok|/images/stories/gravering/db.gif,Enkeltskriveskrift|/images/stories/gravering/es.gif,Dobbeltskriveskrift|/images/stories/gravering/ds.gif);And if I remove the radiobuttons the custom fields at least need one character for adding the product to the basket.

Hope this makes sense? ???

/cbach


brigitte

  • Beginner
  • *
  • Posts: 15
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #19 on: May 15, 2007, 11:12:59 am »
Hi Barnett,

this is really great. it was worth wile the waiting for..
Some overseas questions, i looked at the code but it was too difficult for me :(

- how do i use a Euro sign (utf &#128) in the pricing for different options? I now see a $ sign?
- how can i center the custom attributes in the main body?
- there's a difference in layout using firefox and safari. Is the solution found in this hack or is it VM. Eg 3 pictures with radio buttons are in FF displayed horizontal, and in Safari vertical taking up a lot of space.

Any clues are more than welcome!! Hope i did not miss anything...
Hope there are answers, im dying to get this work.

barnett

  • Jr. Member
  • **
  • Posts: 92
    • Contemplate Design
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #20 on: May 15, 2007, 15:04:25 pm »
- how do i use a Euro sign (utf &#128) in the pricing for different options? I now see a $ sign?
- how can i center the custom attributes in the main body?
- there's a difference in layout using firefox and safari. Is the solution found in this hack or is it VM. Eg 3 pictures with radio buttons are in FF displayed horizontal, and in Safari vertical taking up a lot of space.

1.  I think the default currency type is set in VM, unless you did that and now the hack turned it back to American dollars... if so I'll take a look.

2-3. These are CSS styling questions and don't really concern this hack.  Look at the HTML outputted by the hack (view source on your shopping cart) to see what tags, classes, and IDs are produced so you style them appropriately.  Here is a tutorial on floating image thumbnails:
http://css.maxdesign.com.au/floatutorial/tutorial0407.htm

-barnett

brigitte

  • Beginner
  • *
  • Posts: 15
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #21 on: May 15, 2007, 17:05:31 pm »
Hi barnett,


1- i set the currency sign in the shop-details to &#128, his works i guess since all the prices of products are shown in Euro

<Update> Found it: in file ps_product_custom_type.php the $ sign is hard coded. I'll dive into it. i also discoverred that
- the amount used (in my case radio) is ex VAT. I'll have a check as well...
- display of the attribute name is in safari next to the image whilst in ff above the image giving a different layout

2-3 i'll read the tutorial. I found out up to now that i can infuence som of the layout making my own browse page & flypage. The center is easy then. The difficulty is that the page is built up using html tables. I'm learning :)

Txs for looking into the euro thing, and txs for this great module!

william

  • Beginner
  • *
  • Posts: 12
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #22 on: May 16, 2007, 09:31:58 am »
greetings,

1st off, thanks for developing this great modification!

Now, i have several questions,
1. when i do not include a [+x.xx] behind a attribute name, the attribute does not get recorded when adding to cart.  example:

Black|images/stories/color/BLACK.gif <-- the attribute Black doesnt show on the view cart page

Black [+10.00]|images/stories/color/BLACK.gif <-- the attribute Black shows up in view cart page

How can i fix this little bug?

2. Currently, is it possible make add to cart button updates the selection but not direct the customer to the view cart page?

thanks in advance for any and all inputs

vm noob #842 =)

Christian Bach

  • Beginner
  • *
  • Posts: 29
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #23 on: May 16, 2007, 11:44:27 am »
Hi,

The other problem was a syntax error, but now I have two new issues. :) And this time i tripple checked everythinf.

My attributes look like:
Code: [Select]
Linie 1(text)(|1)(|1.00|char_nospace);
Skrifttype(select)(|)(Enkeltblok|images/stories/gravering/eb.gif,Dobbeltblok*|/images/stories/gravering/db.gif,Enkeltskriveskrift|/images/stories/gravering/es.gif,Dobbeltskriveskrift|/images/stories/gravering/ds.gif);
Linie 2(text)(|2)(|1.00|char_nospace);
Skrifttype(select)(|)(Enkeltblok*|images/stories/gravering/eb.gif,Dobbeltblok|/images/stories/gravering/db.gif,Enkeltskriveskrift|/images/stories/gravering/es.gif,Dobbeltskriveskrift|/images/stories/gravering/ds.gif);
Linie 3(text)(|3)(|1.00|char_nospace);
Skrifttype(select)(|)(Enkeltblok|images/stories/gravering/eb.gif,Dobbeltblok*|/images/stories/gravering/db.gif,Enkeltskriveskrift|/images/stories/gravering/es.gif,Dobbeltskriveskrift|/images/stories/gravering/ds.gif)

1) If I choose a different font in the dropdown at the top, then the one in the bottom of the page changes.

2) The char count and prices does not show up in the cart for line 2 & 3?

Again thanks for your work. :)

/cbach

Andoni

  • Beginner
  • *
  • Posts: 4
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #24 on: May 16, 2007, 15:09:00 pm »
Hello, this is a great hack, but i'm finding other thing that i think it's useful to joomla.

Add a Weight type to input the Gr. like you want, for example;

I have a meat product with 10€ by Kg.
I want to buy 100gr. of meat or 125gr or 900 gr.
I insert in this input the quantity, and then calculate € x Weight and obtains the price.
And more... this weight goes to weight product to calculate the shipping costs....

What do you think?

Sorry for my english!

barnett

  • Jr. Member
  • **
  • Posts: 92
    • Contemplate Design
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #25 on: May 16, 2007, 20:30:00 pm »
greetings,

1st off, thanks for developing this great modification!

Now, i have several questions,
1. when i do not include a [+x.xx] behind a attribute name, the attribute does not get recorded when adding to cart.  example:

Black|images/stories/color/BLACK.gif <-- the attribute Black doesnt show on the view cart page

Black [+10.00]|images/stories/color/BLACK.gif <-- the attribute Black shows up in view cart page

How can i fix this little bug?

2. Currently, is it possible make add to cart button updates the selection but not direct the customer to the view cart page?

thanks in advance for any and all inputs

vm noob #842 =)

1. I'll look at this.  What attribute type are you using? checkbox, radio, select, etc.... also could you post your full line of attribute code?  thanks.

2.  This functionality is not handled by this hack.

-barnett

Paul

  • Beginner
  • *
  • Posts: 9
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #26 on: May 16, 2007, 20:42:27 pm »
Thanks for the great mod. I've just installed it and it's working well.

For my needs file upload is the most important/best feature. I was just thinking it would be really helpful if you could access or download the clients uploaded files while viewing their order in the admin screen. Is a link or something like this possible?

Thanks again,
Paul

barnett

  • Jr. Member
  • **
  • Posts: 92
    • Contemplate Design
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #27 on: May 16, 2007, 20:49:33 pm »
Thanks for the great mod. I've just installed it and it's working well.

For my needs file upload is the most important/best feature. I was just thinking it would be really helpful if you could access or download the clients uploaded files while viewing their order in the admin screen. Is a link or something like this possible?

Thanks again,
Paul

currently this hack does not edit the admin experience, but I'll keep it in mind for the next release down the road.
-barnett

william

  • Beginner
  • *
  • Posts: 12
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #28 on: May 17, 2007, 01:04:20 am »
greetings,

1st off, thanks for developing this great modification!

Now, i have several questions,
1. when i do not include a [+x.xx] behind a attribute name, the attribute does not get recorded when adding to cart.  example:

Black|images/stories/color/BLACK.gif <-- the attribute Black doesnt show on the view cart page

Black [+10.00]|images/stories/color/BLACK.gif <-- the attribute Black shows up in view cart page

How can i fix this little bug?

2. Currently, is it possible make add to cart button updates the selection but not direct the customer to the view cart page?

thanks in advance for any and all inputs

vm noob #842 =)

1. I'll look at this.  What attribute type are you using? checkbox, radio, select, etc.... also could you post your full line of attribute code?  thanks.

2.  This functionality is not handled by this hack.

-barnett

the line of codes i used is as following:

Size Options(Radio)(Select the SIZE)|title-hover)( Small [+0.00], Medium [+0.00], Large [+0.00], X-Large [+0.00], 2X-Large [+0.25] );Color Options(Radio)(Select the color and size, then enter quantity|title-hover)( Black [+0.00]|images/color/BLACK.gif, Red [+0.00]|images/color/RED.gif);  <-- this adds to shopping cart fine

Size Options(Radio)(Select the SIZE)|title-hover)( Small [+0.00], Medium [+0.00], Large [+0.00], X-Large [+0.00], 2X-Large [+0.25] );Color Options(Radio)(Select the color and size, then enter quantity|title-hover)( Black|images/color/BLACK.gif, Red|images/color/RED.gif);

<-- this one, doesnt catch the black or red attribute when adding to shopping cart.

and also, how do i modify the format these attributes are displayed on the frontend?

thanks

William

Paul

  • Beginner
  • *
  • Posts: 9
Re: Custom Attributes Extended 2.0 [Hack]
« Reply #29 on: May 17, 2007, 06:33:55 am »
A quick question (sorry if this was previously posted and I missed it) - for the text input lines is it possible to set the maximum number of characters a client can input? An example would be if I am engraving a trophy and can only fit 25 characters per line.

Thanks,
Paul