Wordpress/Woocommerce - Two products share same stock? - wordpress

I am looking for a way to allow two products to share the same stock/inventory. Everything I have come across suggests using variations but this doesn't work in my case.
This is my current situation. I am selling a unisex t-shirt but would like it to show up in both the mens section and womens section on my store. The tees already have variations in that they are being sold in sizes XS-XL. Ideally, in the mens section the product image would be of a male model wearing the tee and in the womens section the product image would be of a female model wearing the tee. So they're technically two different products but at the end of the day it's all coming from one stock, so I need these two products to share their inventory.
Any help would be much appreciated! Thanks in advance :)

You could technically achieve this by using SQL code and events.
ie,
Create two products that are to share the same stock
Create SQL script that updates the stock level of both products to the lowest amount where there is a mismatch
Create SQL event in database that activates this basic script every 15 minutes.
It's not perfect, and it probably won't work on a shared server (rarely do you have event access on shared services), but it works in theory. You could also do this via cron/php script, but I'm not great at php so, meh.
Here's a similar thing I did for cost of goods sold in my database:
UPDATE wpi1_postmeta as pm
INNER JOIN wpi1_atum_product_data as atum
ON atum.product_id = pm.post_id
SET pm.meta_value = atum.purchase_price
WHERE atum.purchase_price is not NULL
AND atum.purchase_price <> pm.meta_value
AND pm.meta_key = '_woosea_cost_of_good_sold';

Related

WooCommerce - WooSquare Plus plugin - plus product variations must be an array

WooSquare plugin failed to synchronize products between WooCommerce and Square.
I had a look at the contents of the xxxx_woo_square_integration_logs table in the WordPress database. One of the log entries said - "variations must be an array". I had a brief look at the program that I thought was performing the synchronization, WooToSquareSynchronizer.php and it had a statement:
$product_variations = unserialize($productDetails['_product_attributes'][0]);
Despite variations having another meaning in WooCommerce, the code appears to suggest what we are talking about here is product attributes. I guessed that the code expects at least one attribute for each product. I added a single global attribute and then set that on each of my products. My products were then successfully synchronized. Note that this failure only occurred when creating products, not when updating products. Looking at the WooSquare plus documentation, product variations looked to managed with attributes but in my case, I was not using product variations.
P.S. Could someone with 1500 reputation please add "WooSquare plus" as a tag?
References:
https://apiexperts.io/documentation/woosquare-plus/ (NOT TO BE CONFUSED WITH WooSquare Pro!).
https://apiexperts.io/fast-support/
This is probably the free version - https://wordpress.org/support/plugin/woosquare/reviews/ - https://apiexperts.io/documentation/woosquare/

Customer segmentation price list does not work as expected in basket and checkout

The problem
We have created a customer segment and linked both a customer and a price list to this customer segment. The linked price list defines a special price of $5 for one of the products. This product has a 'default' price of $10.
When I login to the storefront with a user that belongs to customer segment, I see the correct price of $5 on the PDP. However once this product is added to the basket, it shows the 'default' product price of $10 in the minicart and on the cart page. I would expect to see $5 there as well.
Technical information
The (correct) price on the PDP is retrieved directly from the ProductBO by using the default ISProductPrice module which links to the default ProductPrice.isml.
<ISProductPrice
ProductBO="#ProductBO#"
Currency="#CurrentRequest:Currency#"
ShowInformationalPrice="true"
RichSnippetsEnabled="#RichSnippetsEnabled#"
>
The (wrong) price on the cart page is retrieved from the BasketComputedProductLineItemBO with the following (default ISH) code
<isif condition="#PriceDisplayType EQ 'net'#">
<isprint value="#PLI:SingleBasePriceNet#">
<iselse/>
<isprint value="#PLI:SingleBasePriceGross#">
</isif>
What I've tried so far
Clear cookies/cache to make sure we have a completely new basket
Made sure the Customer Segmentation Service is enabled (default ISH service).
Tried all the different methods to fetch a price from the BasketComputedProductLineItemBO
Added a couple of different products to the price list
Added a couple of different customers to the customer segment
Ran a search index
Tried to reproduce the issue on the ISH demo server
Checked the documentation on customer segmentation from the ISH support page
Tried to add a customer to the price list directly instead of a customer segment. When doing it this way, everything seems to work as expected.
At this point I'm completely stuck. Any help on how to go from here would be greatly appreciated.
Check this
https://support.intershop.com/kb/index.php/Display/IS-22923
If you search on segment on the support for version 7.9 then you get few bugs. Disable the dynamic segment service because it is buggy. See if that work or else i think you really do have a platform bug here.
Also a good idea to upgrade to the lastest minor version.

Microsoft Dynamics AX 2012 - Purchase Price

I've been instructed to create a customization on how the Unit Price (Purchline.PurchPrice) is calculated.
Right now when I'm creating a new purchase order and select an item, it simply pulls from the pricing from the released products for that particular item.
For my customization, I'm going to be using 3 variables to determine the pricing.
1: ItemId
2: Current Session Date
3: Customized Field in the Purchase Header
As such, I'll need access to purchline for the ItemId on the current line, and access to purchtable to access my field in the header.
Right now there is a big process for how the pricing gets pulled from released products, how the system checks for discounts, etc.
My question is, can anyone suggest the best class/location to check and modify where my final PurchPrice field gets set and inserted into purchline?
I need this to be basically the last part of the process of how this PurchPrice gets calculated. I've looked around in the PriceDisc & PriceConvert classes, SalesPurchLine map, the modified method of the ItemId field of the form.
AxPurchline doesn't seem to be triggering at all when I put breakpoints in them and create new purchase order lines.
Any help, insight or advice on where it would be the best to make logic changes for the PurchPrice field would be greatly appreciated.
Thanks in advance!
The table Purchline actually has a method called setPriceDisc where the price agreement is set and the line amount is adjusted.
This seems to be the last place where PurchLine.PurchPrice is set.

AX 2012 Vendor Prepayments Posting

There is a new feature called Vendor Prepayments in AX 2012. It basically allows a company to prepay a vendor before the receipt of any goods. This was not there in AX 2009. So a user can basically attach a Prepayment record to a Purchase order and then post something called Prepayment invoice. When goods finally arrive, this Prepayment invoice is then applied to the "Real" Vendor invoice and settled. Its pretty straightforward and i guess logical.
My requirement is to do this Prepayment Invoice posting by code in X++.
If i try to use the PurchFormLetter class like below, it will post the Real invoice, which wont be correct as in the case of prepayments, there is no inventory transactions.
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTable,
'8001',
systemDateGet(),
PurchUpdate::All,
AccountOrder::None,
NoYes::No,
NoYes::Yes);
I have looked around in AX Dev Guides, on google, on blogs but no help.
Does anybody know this?
I believe you should look into PurchPrepayTable table logic and PurchPrepayTable form. If you are using a single prepayment for a single purchase order then you can link the prepayment with a purchase using PurchPrepayTable.PurchTable.
If you're willing to accomplish that by calling the X++ code, I would recommend:
Check if any PurchPrepayTable exists for the purchase order;
If it does -- update it (please make sure you run all validations before that);
If it does not -- create a new prepayment (please also refer to PurchPrepayTable table methods to make sure your values in prepayment pass all validations).

Drupal OG Views: cannot create view of all groups of which I am *not* currently a member

(Also posted as http://drupal.org/node/596860)
I would like to create a view showing only those groups of which I am not already a member (or a pending member). However, the obvious way of doing this (take the og_my view and change the filter "Organic groups: Group member" to false) does not work.
The reason is that the SQL query essentially returns one row for every user in the group that matches your conditions. If you're searching for yourself (as in og_my), each group node will only show up once; if you're not searching for yourself, each group node shows up N times, where N is the number of other group members. Thus the groups of which I'm already a member continue to be displayed as long as there's at least one other member.
Does anyone have a way around this?
Thanks, Adrian
You may not be able to achieve this in Views directly as it does not support subqueries. My SQL came out like so:
SELECT node.nid AS nid, node.title AS node_title FROM node node LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid WHERE (node.type IN ('campaign','setting','system')) AND node.nid NOT IN (select nid from og_uid where uid = 1);
It is said you can programmatically forward the results of such a query into the Views system for theming.
Maybe a special handling of the argument Organic Groups:Member of a Group, Exclude Argument option?
I also posted to d.o in hopes of pushing the issue conversation onward.
Wild. OG Views Extra was made available on d.o three days after your first revision of this question. I haven't used it, but looks just like it may do it.
So why install this module? If you need finer-grained control. The
available user options:
Not a Group Member
Group Member or Site Admin
Group Member Only

Resources