How can i get j2store order details in my custom component view by order id? - joomla

How can i get Order detail by Order id in j2store Component for joomla?
I am using custom component and i need to use j2store order in my component custom view.
I have tried this code to get order :
$order = F0FModel::getTmpInstance('Orders', 'J2StoreModel')->initOrder($j2store_order_id)->getOrder();

Related

Add variable product to cart using ajax woocommerce

I am trying to add variable products to cart using woocommerce via ajax.I am following the option where I call query string http://xxx/cart/?add-to-cart=PRODUCT_ID&variation_id=VARIATION_ID&attribute_pa_colour=ATTRIBUTE_SLUG.
I am able to dynamically pass the product id using $product->id. But I am clueless as to how I will get the variation id and selected attribute value. I tried using $post_id = $variation->ID but its not working. Kindly Help.I am using a plugin to display the variation and swatches.

Orchard Ajax Request

Currently we have a few products defined in Orchard.
We managed do display these products by using a query in combination with projection.
I executed the same steps as described in this tutorial, Defining and rendering the ProductCatalog Content Type
There is also a menu to navigate inside products catalog. When selecting category, the full page is refreshed. How can we implement a ajax request each time user select a product category in menu?
Here i will show you an example of the screen:
I guess your best bet is to do something along those lines:
Create a module with a custom ApiController
Write an alternate for your category navigation in which you send an ajax request to your controller
Use IContentManager in your controller to query for your products and return them as a json result
Update your page from your result

Display products against attributes in magento

I am working on custom module in magento.
I create two new attributes (combo box) make and location. After that I add values for these attributes using custom code against specific product. Like I add make "Sony" and location is "Australia" against product 1 (1 is id for product).
Now on admin side i want to display this product with attributes values like make is Sony and location is Australia and product is 1.
I found some tables where these values are linked like (catalog_product_entity_int,eav_attribute,eav_attribute_option,eav_attribute_option_value), but I am unable to query such records. The page where I want to display data I have attribute id and attribute code.
Can anyone knows how I can figure it out?
Very simple Dude.
inside your _prepareCollection() method of your custom module grid
Load the product collection and select these two attribute... If there is a need to filter it by these two attributes then do it.

Magento: Category product design update not applied to search result products

I'm using a design update XML applied to all products under specific categories. The update is applied successfully to those products when browsed to them from those categories, but not when those products are opened from search results. How can I make the design update affect those products when opened from search results?
You need to add a layout handle that you can "grab" for each one of these products and modify the layout through layout xml files.
The key to this process is in the initProductLayout method of Mage_Catalog_Helper_Product_View. This method is where custom layout handles are added based on the product model. You can grab the layout update object from the controller and call addHandle() on it with a string to add that handle. So you'll want to rewrite this method and do something like this:
$update = $controller->getLayout()->getUpdate();
foreach ($product->getCategoryIds() as $categoryId) {
$update->addHandle('PRODUCT_IN_CATEGORY_' . $categoryId);
}
Now, in a layout xml file you can target the <PRODUCT_IN_CATEGORY_##> handle for the ID of your category(ies) and any layout updates you put here will be applied to the product view page no matter how it is accessed.
Depending on the specifics of your installation, it may make more sense to key the handle with some other category identifier, like the name or URL key, instead of the numeric ID. For this, use $product->getCategoryCollection() and iterate through the collection to grab what you need. You may also want to use $product->getAvailableinCategories() if you want to include only category IDs that the product belongs to directly (instead of including categories of higher parentage).

magento adjust product visible

I have 2 new custom productattributes that enables or disables a product in the category list and product-detail page.Both are dates.
need to calculate if the current date is between the 2 custom dates.
if it is, the product must be enabled.
I can't find a place in the code to enable/disable a product in the category list and detail page. I don't want to fix this in a phtml.
Can somebody help me?
You have to modify two things :
the product collection in order to add the filtering on your two news attributes.. For that, for example, you can implement the event catalog_block_product_list_collection from Mage_Catalog_Block_Product_List (used in product listing and search) where you'll add your filtering with the function $collection->addAttributeToFilter('attribute_code', $condition)
the product page itself. You can add your logic in order to display or not your product by multiple ways.. I would choose to implement the event catalog_product_is_salable_after in order to add your logic here and call $product->isSalable() in the template or controller...

Resources