Thank you for your extensive help on this. I wanted to make the decision up to the customer to choose, not just up to the advance_orders status. I ended up adding a custom item field that is a single dropdown with the values of hold or send. Hold will hold all items in the order until the backordered items become available therefore grouping the packages, and send will send in stock items now and backorder items when they become available therefore not grouping the packages. I went into my product/show_block_custom_item view and replaced the code
foreach ($this->itemFields as $fieldName => $oneExtraField) {
$itemData = JRequest::getString('item_data_' . $fieldName, $this->element->$fieldName);
?>
<tr id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_name">
<?php
if($oneExtraField->field_required==1){
echo str_replace('</label>','<span class="star"> *</span></label>',$this->fieldsClass->getFieldName($oneExtraField));
}else{
echo $this->fieldsClass->getFieldName($oneExtraField);
}?>
</span>
</td>
<td>
<span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_value"><?php
$onWhat='onchange';
if($oneExtraField->field_type=='radio')
$onWhat='onclick';
$oneExtraField->product_id = $this->element->product_id;
if($fieldName == "reloading_powder"){
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="minimumPowder(jQuery(\'#hikashop_product_quantity_main input[id*=hikashop_product_quantity_field_]\').val());hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}else{
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}
?></span>
<div id="hikashop_invalid_field_<?php echo $fieldName; ?>" class="alert alert-error">
</div>
</td>
</tr>
<?php }
with this
if($this->element->advance_orders == 'Backorder'){
foreach ($this->itemFields as $fieldName => $oneExtraField) {
$itemData = JRequest::getString('item_data_' . $fieldName, $this->element->$fieldName);
?>
<tr id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_name">
<?php
if($oneExtraField->field_required==1){
echo str_replace('</label>','<span class="star"> *</span></label>',$this->fieldsClass->getFieldName($oneExtraField));
}else{
echo $this->fieldsClass->getFieldName($oneExtraField);
}?>
</span>
</td>
<td>
<span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_value"><?php
$onWhat='onchange';
if($oneExtraField->field_type=='radio')
$onWhat='onclick';
$oneExtraField->product_id = $this->element->product_id;
if($fieldName == "reloading_powder"){
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="minimumPowder(jQuery(\'#hikashop_product_quantity_main input[id*=hikashop_product_quantity_field_]\').val());hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}else{
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}
?></span>
<div id="hikashop_invalid_field_<?php echo $fieldName; ?>" class="alert alert-error">
</div>
</td>
</tr>
<?php }
}else{
foreach ($this->itemFields as $fieldName => $oneExtraField) {
$itemData = JRequest::getString('item_data_' . $fieldName, $this->element->$fieldName);
if($oneExtraField->field_namekey == "customtext_93_13_54_27" || $oneExtraField->field_namekey == "backordered_item"){
continue;
}else{
?>
<tr id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_name">
<?php
if($oneExtraField->field_required==1){
echo str_replace('</label>','<span class="star"> *</span></label>',$this->fieldsClass->getFieldName($oneExtraField));
}else{
echo $this->fieldsClass->getFieldName($oneExtraField);
}?>
</span>
</td>
<td>
<span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_value"><?php
$onWhat='onchange';
if($oneExtraField->field_type=='radio')
$onWhat='onclick';
$oneExtraField->product_id = $this->element->product_id;
if($fieldName == "reloading_powder"){
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="minimumPowder(jQuery(\'#hikashop_product_quantity_main input[id*=hikashop_product_quantity_field_]\').val());hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}else{
echo str_replace('<span class="hikashop_field_required">*</span>','',$this->fieldsClass->display(
$oneExtraField,
$itemData,
'data[item]['.$oneExtraField->field_namekey.']',
false,
' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
));
}
?></span>
<div id="hikashop_invalid_field_<?php echo $fieldName; ?>" class="alert alert-error">
</div>
</td>
</tr>
<?php }
} //added div id="hikashop_invalid_field_ above to show the required fields error message before adding to cart
}
Then I did as you said
In both, you'll find that line:
foreach($local_usable_rates as $k => $rate){
in the function onShippingDisplay of the plugins main file plugins/hikashopshipping/fedex/fedex.php and plugins/hikashopshipping/ups/ups.php
You can replace these with such code:
$backordered_items = false;
$config = hikashop_config();
$group = $config->get('group_options', 0);
foreach($order->products as $i => $row){
if(empty($row->cart_product_quantity)) continue;
if($group && $row->cart_product_option_parent_id) continue;
if($row->advance_orders !== 'NA') $backordered_items = true;
}
foreach($local_usable_rates as $k => $rate){
$rate->shipping_params->group_package = $backordered_items;
I just change the code to use to
$backordered_items = false;
$config = hikashop_config();
$group = $config->get('group_options', 0);
foreach($order->products as $i => $row){
if(empty($row->cart_product_quantity)) continue;
if($group && $row->cart_product_option_parent_id) continue;
if($row->backordered_item == 'hold') $backordered_items = true;
}
foreach($local_usable_rates as $k => $rate){
$rate->shipping_params->group_package = $backordered_items;
For UPS it works great. When someone chooses send instead of hold the shipping is almost double. For Fedex however, I'm not seeing any changes in the price whether it is set to hold or send. Is there a special way I have to setup the Fedex plugin to where the group packages will be set up right? Also about the Fedex plugin, I had a customer place an order yesterday and chose Fedex as their shipping method. When I went to Fedex to create the shipment, the service (Home Delivery) is not even available in their area. My question is if the service that the plugin is setup for is not available in that person's location why is it coming back with a shipping rate? Shouldn't it not even show up as an option? I've attached a screenshot of how I currently have it setup. One other question, is there a way to setup where custom item fields can be changed in the cart?