Skip to main content

Populate Custom Field Value in Manual Shipping Inf

More
13 years 11 months ago #72007 by SuzyBGood
Hi There,

For the charity we run a campaign and the products are delivered to the campaigning organization on a certain date. Is there a way to populate this organization name (taken from the custom field on an earlier step) into the

Hand delivered Free shipping

Choose this method and your order will be delivered to your chosen Organization

Easy? Possible?

Thanks!
Susan

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

More
13 years 11 months ago #72064 by Xavier
Hi,

Yes it's possible, for your shipping method description click on the toggle editor and replace the text by:
Code:
Choose this method and your order will be delivered to your chosen <div id="chsnOrg">Organization</div> ...

Then in HikaShop > Display > Views, edit the view "checkout / custom_fields" and replace the exiting code by:
Code:
<?php $type = $this->type; foreach($this->extraFields[$type] as $fieldName => $oneExtraField) { ?> <tr class="hikashop_checkout_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>"> <td class="key"> <?php echo $this->fieldsClass->getFieldName($oneExtraField);?> </td> <td> <?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick'; echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data['.$type.']['.$fieldName.']',false,' '.$onWhat.'="document.getElementById(\'chsnOrg\').innerHTML = this.value; hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"'); ?> </td> </tr> <?php } ?>

If you have many custom fields in the checkout, an "if" condition will be necessary to do the action only if the custom field is the good one.

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

More
13 years 11 months ago #72286 by SuzyBGood
Hi Xavier,

Thanks. Do I need to set the custom field to be chsnOrg somewhere? I have made these changes.. and it's blank

" Pick Up Free shipping

Choose this method and your order will be delivered to
on the arranged Campaign Date .."

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

More
13 years 10 months ago #72480 by nicolas
Hi,

Xavier didn't understand what you wanted to do.

You want to add in the shipping description to value of a custom field which has been selected previously.


That's possible with a small view modification but we would need a screenshot of the options of your custom field in order to tell you what to do exactly.

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

More
13 years 10 months ago #72504 by SuzyBGood
Hi There,

Thanks.. I did what Xavier suggested using the column name "organizername", no luck.

Attached is my custom field screenshot. THANKS!

Suz

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

More
13 years 10 months ago #72776 by nicolas
Hi,

You can edit the file "shipping" of the view "checkout" via the menu Display->Views and change the code:
<div class="hikashop_checkout_shipping_description"><?php echo $rate->shipping_description;?></div>

to:
<?php
$app = JFactory::getApplication();
$order = $app->getUserState( HIKASHOP_COMPONENT.'.checkout_fields',null); ?>
<div class="hikashop_checkout_shipping_description"><?php echo str_replace('{organizer}',@$order->organizername,$rate->shipping_description);?></div>

Then, you can use the tag {organizer} in your shipping methods description and it will be replaced by the selected value of that custom field.

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

Time to create page: 0.196 seconds
Powered by Kunena Forum