WebsiteBaker Support (2.8.x) > Bakery Shop

Include a product by default with each order[solved]

(1/2) > >>

gearup:
Hi,

Right now there is a need to add an "Order Processing Fee" as a flat charge to each order.

My idea is to add a product with this title and mark it inactive so it is not displayed to the customer.

Alternatively it could be Active but not displayed perhaps by controlling it by its ID in Page Settings, Product Loop.

Then with the "Add to Cart" action on any other product it is added by default (if not already added) and this would be hard coded maybe in add_item.php but I am not sure how to do this.

Also it would need controlling in the Cart so the quantity could not be modified.

Bakery version in use is 1.60 with WB 2.8.3 SP1.

Anyone any ideas?

Regards,

hillschmidt:
There is this option under "Shipping": "a flat Amount" - see here a screenshot from my German bakery:

Isn't this the option you'll need?

gearup:
hi Hillschmidt,

thanks for your input. I was aware of this option and know how it works but unfortunately it is not what I have been asked to do.

For marketing reasons shipping needs to be shown as Free (0.00).

The charge that is wanted to be added is for services provided by a 3rd party.

The bean counter guy has said he wants this to be separate from shipping.

As I was not sure what to do I moved this down (off) my list :|

Now they want the website to go live next week and I am a bit stuck :(

It was suggested that later they may give free items with each order so I thought to add this "Order processing fee" as a product would allow me to sort of kill two birds with one stone and gain the experience for the change they would later need.


What I think I need is to find what to add to the php when someone presses "add to cart" so that the product I have already added and know the ID for is included in the Add method.

Of course it needs only adding once but that can be a secondary task.

Regards,

hillschmidt:
If Shipping is ALWAYS free, you could consider to do the following:
- insert in the templates for order card, invoice, etc. a static text: Shipping cost 0 US$ in the same format as the rest,
- change the language file(s) of the original Shipping field from "Shipping" to "Order processing fee"
and you're close to I suggest.
This way should easily be implemented, and the processing of this fee will automatically work in the whole bakery processing like a shipping fee.

This will not solve your problem on how to include one (or more) items AUTOMATICALLY to each order ... here I suggest that the developer should consider this as an future enhancement 'cause it seems a very good feature ...
The article options could be expanded by additional fields "include in each order", "quantity", "order limit for processing/including" - but of course this will require a lot of changes in all scripts needed during the processing.

gearup:
Hi hillschmidt,

thanks for your input.

I had considered modifying the shipping text as you suggested but decided against it. Yes shipping will always be free except when my boss decides it is no longer free. So for me I will leave shipping untouched.

However, I have had some success and have a better idea what area needs changing but I don't have it working properly yet.

I made some changes to Bakery files;

view.php (line 230 - $item_id = 39;)
I hard coded the id for the fixed charge item and it gets added to the cart OK

--- Code: --- if (substr($field,0,4) == "item" && $value > 0) {
// Get item_id
//$item_id = substr($field,4,strlen($field)-4);
$item_id = 39;
// Get item attributes and make comma separated string
if (isset($_POST['attribute'][0])) {
$attributes = implode(",", $_POST['attribute']);
} else {
                              ....

--- End code ---

Now I can see this will work I will need to undo this and add code to an earlier place in view.php where the order_id is created so that I can do a run once operation to add my fixed charge product item.

I have had a couple of goes at this but so far been unable to get it to work.

The other change I wanted to make was to make the field for quantity displayed in the Cart be read only for this item.

so in \templates\cart\table_body.htm
I modified the code as shown below (my changes are the added php).
It did not quite work but at least I did get a second read only column for quantity (cart image is attached)

maybe someone can suggest why my 'if' clause is not working


--- Code: ---<tr>
<td class="mod_bakery_cart_td_thumb_f"><a href="{LINK}"><img src="{THUMB_URL}" alt="{NAME}" width="{THUMB_WIDTH}" height="{THUMB_HEIGHT}" border="0" /></a></td>
<td class="mod_bakery_cart_td_sku_f">{SKU}</td>
<td class="mod_bakery_cart_td_name_f"><span class="mod_bakery_cart_item_f">{NAME}</span><br />{ATTRIBUTE}</td>
<td class="mod_bakery_cart_td_quantity_f">
<?php $id = "{ITEM_ID}";
if $id != "39"): ?>
<input type="text" name="quantity[{ITEM_ID}][{ATTRIBUTES}]" value="{QUANTITY}" id="id_{ITEM_ID}_{ATTRIBUTES}" style="text-align: right" size="4" />
<?php else: ?>
<input type="text" name="quantity[{ITEM_ID}][{ATTRIBUTES}]" readonly="readonly" value="{QUANTITY}" id="id_{ITEM_ID}_{ATTRIBUTES}" style="text-align: right" size="4" />
<?php endif; ?>
<a href="#" onclick="javascript: mod_bakery_delete_item_f('{ITEM_ID}_{ATTRIBUTES}');"> <img src="{WB_URL}/modules/bakery/images/delete.gif" alt="{TEXT_DELETE}" title="{TEXT_DELETE}" /></a></td>
<td class="mod_bakery_cart_td_price_f">{PRICE}</td>
    ....

--- End code ---

Here is the current Cart display,


Navigation

[0] Message Index

[#] Next page

Go to full version