Author Topic: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5  (Read 76737 times)

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #135 on: August 24, 2012, 12:57:26 pm »
Oh, I figured it out!
The $value in the output of the process function can't be an array. Only single. Now it's working!!!
Thanx Webgobe, you inspired me!

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #136 on: August 24, 2012, 13:05:11 pm »
Be welcome!  :-*
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #137 on: August 27, 2012, 22:23:38 pm »
I've added some code. So now i can hide/show any attribute i need. For instance for some "advanced options" in your product that you don't want to show up upon page load, but as soon as you click "More options" (can be other text) you will see any additional attributes. It's not dependant on the type of the attributes, you only put the start and the end attributes, and everything between them will be hidden. I think it's a good alternative to the group attributes. I can share if somebody's interested.

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #138 on: August 28, 2012, 08:07:28 am »
I am ;)
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #139 on: August 28, 2012, 08:26:38 am »
Just add these two classes to the ps_product_custom_type.php file.

Code: [Select]
/***************************************************
 *
 * Advoptions element class
 * The class is is used to manage the product custom attribute type.
 *
***************************************************/
class ps_product_custom_type_advoptions extends ps_product_custom_type_base {
var $classname = "ps_product_custom_type_advoptions";

    /**
* Outputs HTML for Custom Attribute
*/
function customTypeHTML($field=array()) {
    $attr_value = explode('|',$field['attr_value']);
$opt_id = $attr_value[0];
$opt_name = $attr_value[1];
//$opt_items = $attr_value[2];
$html = "";
if( ($field['attr_tip_position'] == 'title-hover') && ($field['attr_tip']) ){

//$mainframe->addCustomHeadTag( '<script type="text/javascript" src="'. $mosConfig_live_site . '/includes/js/overlib_mini.js"></script>' );
$html .= "<br/><div style='text-align: center' id=\"".$opt_id."\" onclick=\"hide_or_show();\" class=\"tip\" onMouseOver=\"change_cursor(); return overlib('".trim($field['attr_tip'])."',CAPTION, '".$opt_name."', BELOW, RIGHT);\" onmouseout=\"restore_cursor(); return nd();\" ><b>______________<font color='red' face='Arial'>↓_".$opt_name."_↓</font>______________</b></div><br/><br/>";
} else {
$html .= "<br/><div style='text-align: center' id=\"".$opt_id."\" onMouseOver=\"change_cursor();\" onmouseout=\"restore_cursor();\" onclick=\"hide_or_show();\"><b>______________<font color='red' face='Arial'>↓_".$opt_name."_↓</font>______________</b></div><br/><br/>";
}
$html .= "
<script type=\"text/javascript\">
function change_cursor() {
document.getElementById('".$opt_id."').style.cursor = 'pointer';
}
function restore_cursor() {
document.getElementById('".$opt_id."').style.cursor = 'default';
}
var hos = 0;
function hide() {

alldivs = document.getElementsByTagName('div');
var start = 0;
for(var i=0; i<alldivs.length; i++){
if (start == 1){
alldivs[i].style.display = 'none';
}
if (alldivs[i].id == \"".$opt_id."\") start = 1;
if (alldivs[i].id == \"".$opt_id."_end\") start = 0;
}
hos = 1;
}
function show() {
alldivs = document.getElementsByTagName('div');
var start = 0;
for(var i=0; i<alldivs.length; i++){
if (start == 1){

alldivs[i].style.display = 'block';
}
if (alldivs[i].id == \"".$opt_id."\") start = 1;
if (alldivs[i].id == \"".$opt_id."_end\") start = 0;
}
hos = 0;
}
function hide_or_show(){
if (hos == 1) {
show();  return;
}

if (hos == 0) {
hide();  return;
}
}




";

$html .= "</script>";
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 '';
}

}

/***************************************************
 *
 * Advoptionsend element class
 * The class is is used to manage the product custom attribute type.
 *
***************************************************/
class ps_product_custom_type_advoptionsend extends ps_product_custom_type_base {
var $classname = "ps_product_custom_type_advoptionsend";

    /**
* Outputs HTML for Custom Attribute
*/
function customTypeHTML($field=array()) {
    $attr_value = $field['attr_value'];
$opt_id = $attr_value;
$html = "";
$html .= "<div id=\"".$opt_id."_end\"></div>";
$html .= "
<script type=\"text/javascript\">
hide_or_show();
</script>";
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 '';
}

}
 

Now to make it working, put a "advoptions" attribute on the product page, the syntax is very simple:
(advoptions)(some very nice tip | location)(ID , title);
ID should start with a letter and may have (a-z, A-Z, 0-9, -, _) it must be unique (try to make up something sophisicated), title - is what visitors will see.
Then put any number of attributes after this one.
Afterwards, make the closing attribute as follows:
(advoptionsend)(|)(ID)
The ID should be the same as in the beginning attribute (i.e. advoptions). It's important, otherwize it will hide half of your page.
That's it.
You can, of course, customize the appearance and color of the title in the code.

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #140 on: August 28, 2012, 11:44:14 am »
thanks!
If you agree, I will add it to the "official" hack  ;)
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #141 on: August 28, 2012, 12:01:57 pm »
Yes, let it be useful to all.
By the way i have customized the hack even more to meet my needs (banner printing company).  For example i added a possibility of having the edges of a surace be sewed around or not so the code will take in account the given perimeter and the sides chosen and will add a corresponding price to the banner's surface previously calculated. You can see the hack in action on this page . Sorry, in Swedish. There you can see standard options and if you hit "Mer alternativ", you wil see the rest of the options. "Sydda kanaler"represents four sides of the banner (up,down,left,right). The "Keder" option is almost the same but only with upper and lower sides. It's quite a specific hack, so i'll leave it to your advice.

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #142 on: August 28, 2012, 12:15:21 pm »
Aha, I have something similar for the Surface (or the windowshield??) attribute allready in plance. Indeed, is very specific, might not be needed to be included in the mainstream.
OK, will put together anyway a new version - with couple of minor bugfixes, etc, and will publish it!
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #143 on: August 28, 2012, 12:52:56 pm »
And you may probably want to change the way the hack behaves when a hovered title with a tip "title-hover" is accidentally clicked (it leads to the homepage on my site).
You can put some div  instead in the file ps_product_custom_attribute.php:

this:
Code: [Select]
$html .= "<div class=\"tip\" onMouseOver=\"return overlib('".trim($field['attr_tip'])."',CAPTION, '".trim($field['attr_title'])."', BELOW, RIGHT);\" onmouseout=\"return nd();\" ><label for=\"".trim($field['attr_pagevar'])."_field\">".trim($field['attr_title'])."</label>:</div>";
instead of this:
Code: [Select]
$html .= "<a href=\"\" class=\"tip\" onMouseOver=\"return overlib('".trim($field['attr_tip'])."',CAPTION, '".trim($field['attr_title'])."', BELOW, RIGHT);\" onmouseout=\"return nd();\" ><label for=\"".trim($field['attr_pagevar'])."_field\">".trim($field['attr_title'])."</label>:</a>";

timkolm

  • Beginner
  • *
  • Posts: 40
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #144 on: September 08, 2012, 23:24:20 pm »
Some  clients can't wait untill a file upload finishes they just can't determine whether the site is working or something went wrong, especially when file is quite big. All they see is their browser's spinner showing them that the page is about to load in uncertain time.
I managed to implement a simple upload spinner near the file upload input field. You can watch it's work in here:
http://www.banderollkungen.se/layout.html?page=shop.product_details&flypage=flypage2rollup.tpl&product_id=1&category_id=1
It will turn on if you've chosen a file and clicked "Add to Cart" button.

crisware

  • Beginner
  • *
  • Posts: 11
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #145 on: September 28, 2012, 18:54:15 pm »
Hello and congrats for this extremely useful hack! Where can I find the last version of this hack?

Thank you!
Regards
Christopher

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #146 on: September 28, 2012, 21:15:11 pm »
Link in the first post of the thread or on my homepage.
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!

crisware

  • Beginner
  • *
  • Posts: 11
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #147 on: September 29, 2012, 01:02:43 am »
Thank you!!! :)

crisware

  • Beginner
  • *
  • Posts: 11
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #148 on: October 04, 2012, 02:39:50 am »
Hello again,

I just installed VM 1.1.9 on Joomla 1.5.25 and replaced files with yours for Custom Attributes features!
It is really such a nice extension!
Although I have a problem. If I set an attribute as checkbox and more than one values have price difference (e.g. -> Select Values (checkbox)(test1|test1)(value1 [+0.20], value2 [+0.40]); ) and more than one values are checked by customer, it is not calculates at all attribute prices and they are not summarized on the final price.

What have I done wrong?

Thank you!

Regards,
Christopher

webgobe

  • Advanced
  • Full Member
  • *****
  • Posts: 535
  • Follow me on Twitter! http://twitter.com/webgobe
    • Internet craftsman carrying on the heritage of European manufacturing traditions through original Web designs.
Re: Converted Custom Attributes Extended Hack 3.0 for VM 1.1 + J1.5
« Reply #149 on: October 04, 2012, 09:17:54 am »
Nothing. In fact is a bug around since VM 1.1.3 and I has planned to smash it - is on my shortlist. Just too many to solve and too little time...
I suggest you a workaround: use 2 separate checkboxes, that works. As I will have time, I will fix that annoying bug... but can't promise a deadline. Joomla 1.5 and VM 1.* are fading out, and I am pretty overwhelmed with tasks.
Like a fine wine... Good from the start and getting better over time.
Donations are welcome!