Some product Options

  • Posts: 3
  • Thank you received: 0
9 years 2 months ago #245076

From the begining, i'm spanish, so my english is not my best lenguage.

I'm creating a website for a client who work in the design and print (rotulación, make signs for real shops), for that the products need a custom field with width and height.

After I reed the FAQ section who contain the plugin I've installed and create the custom fields, but i don't know who to continue, any clue?

I've see another topic who say a formula $quantity = $quantity*$product->length*$product->width, but i don't know where I have to put.


Another question is, because the type of work, it must have a section file upload images with the design the customer wants for his sign, what I can do?

EDIT: I resolved the first question, only i've edit the php file of the plugin and change lenght for height.

But I have another problem, now ask me if the user can choose the color for his product, I've implement a color picker with javascrip but it not send to the cart, any clue?

Last edit: 9 years 2 months ago by JFeldaca.

Please Log in or Create an account to join the conversation.

  • Posts: 84424
  • Thank you received: 13718
  • MODERATOR
9 years 2 months ago #245086

Hi,

You can create a custom field of the table "item" and of the type "ajax image" to allow customers to upload an image on the product page.

Regarding the selection of the color, you could either use a dropdown or a checkbox custom field with the different colors.
But if you want something more custom, you might want to create your own type of custom fields by developing a small plugin of the group "hikashop" and implementing HikaShop's Fields API:
www.hikashop.com/support/documentation/6...entation.html#fields
You can look at the plugin plugins/hikashop/datepickerfield/ which adds the "advanced date picker" type to custom fields for references.

Last edit: 9 years 2 months ago by nicolas.
The following user(s) said Thank You: JFeldaca

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
9 years 2 months ago #245131

Thank you for answer me, I resolved the second question.

I was thinking about 3 radiobuttons (In fact I put product variant that way) and when you press the third display the colorpicker...

I see another plugins to get an idea to program the plugin, but I'm very lost.

What I have to do? I understant that I have to start with

<?php
jimport('joomla.plugin.plugin');
class plgSystemCustom_color_pick extends JPlugin{
}

if(!function_exists('hikashop_product_color_pick') && !function_exists('hikashop_product_color_pick_in_order')) {
	function hikashop_product_color_pick(&$product){
		
	}
	
	function hikashop_product_price_for_quantity_in_order(&$product){

	}
}

But I don't know how to continue...

Last edit: 9 years 2 months ago by JFeldaca.

Please Log in or Create an account to join the conversation.

  • Posts: 84424
  • Thank you received: 13718
  • MODERATOR
9 years 2 months ago #245146

Hi,

No, that's not what you need to do. Look at the advanced date picker plugin for an example. It doens't use these functions.
It uses the fields API functions.
You can find it in the folder plugins/hikashop/datepickerfield/ of your website.

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
9 years 2 months ago #245158

But that plugin has two PHP files, one (datepickerfield.php) with

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.6.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashopDatepickerfield extends JPlugin
{
	public function __construct(&$subject, $config) {
		parent::__construct($subject, $config);

		$this->loadLanguage('plg_hikashop_datepickerfield', JPATH_ADMINISTRATOR );
    }

	public function onFieldsLoad(&$fields, &$options) {
		$me = new stdClass();
		$me->name = 'datepickerfield';
		$me->text = JText::_('DATE_PICKER');
		$me->options = array('required', 'default', 'columnname', 'format', 'allow', 'datepicker_options');

		$fields[] = $me;

		$opt = new stdClass();
		$opt->name = 'datepicker_options';
		$opt->text = JText::_('DATE_PICKER_OPTIONS');
		$opt->obj = 'fieldOpt_datepicker_options';

		$options[$opt->name] = $opt;
	}
}

if(defined('HIKASHOP_COMPONENT')) {
	require_once( dirname(__FILE__).DS.'datepickerfield_class.php' );
}

And another with a lot of code (datepickerfield_class.php). Wich one I have to see? Or it is both?

Last edit: 9 years 2 months ago by JFeldaca.

Please Log in or Create an account to join the conversation.

  • Posts: 84424
  • Thank you received: 13718
  • MODERATOR
9 years 2 months ago #245173

Hi,

You need to see both.
The first one, thanks to the onFieldsLoad function tells the system information about the new type of custom field it supports.
The second one, which is loaded by the first one, is the custom field type class.
It's a type class like all the other type classes of fields that you'll find in the file administrator/components/com_hikashop/classes/field.php where the default types are defined.
In that second fiel, you'll need to define the display, show and check functions to add your custom code for the color picker, for the saving of the value (if necessary), and for the display of the value selected (if necessary).

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum