Please if you can help me to get the collection of the current promotions rule i.e. catalog price rule and shopping cart price rule. I have some requirement of client and so want to interrelate both of them.
Thanks in Advance
I have found a way to get the catalog price and price rules rules by id,please see the fallowing example,
$rule = Mage::getModel('catalogrule/rule')->load(1);
$rule->setWebsiteIds("1");
echo $rule->getDiscountAmount();
and for price rule for shopping cart use
$rule = Mage::getModel('salesrule/rule')->load(1);
$rule->setWebsiteIds("1");
echo $rule->getDiscountAmount();
i hope it may help you,thank you.
Related
I want to add a flat discount on my opencart based site Help me how to add this discount? i tried to search extensions but i can't find a free extension to do that any body help
Bulk discount on all products.
You can apply discounts under the discount tab here:
If you want to apply a discount to all products directly in the database, first make a copy of your shop and run an SQL query like this on the copy:
UPDATE `oc_product`
SET price = price * 0.9
Then once you've confirmed it works as expected, take a backup of your database and run the command on it.
Is it possible to compare simple products that belong to a grouped/configurable product?
We are using configurables/grouped products in Magento2
The associated simple products are set „not visible individually“ in the Backend (Visibility-Attribute).
We need to be able to use the compare funktion for the associated simple products without changing the visibility for those.
Thanks for your help!
I have to get product list using related product, which product added in simple product as a related product. I have pass reveser query.
Please help me.
Thank you
You can pass product id for which you require related product.
E.g You need related product for a particular product (Say $_product)
You can get related product ids by
$_product->getRelatedProductIds()
You can see array of ids by :
print_r($_product->getRelatedProductIds());
I hope this will help you.
Regards, Manju
I have find my question of answer.
$collection = Mage::getModel('catalog/product_link')
->getCollection();
$related_products = $collection->getData();
foreach ($related_products as $_product){
$_product = Mage::getModel("catalog/product")->load($_product['linked_product_id']);
}
Its work for me.
what I have done? and what I need?
I have created two module 1.invoice 2. payment there is one to many relationship between invoice and payment
it means one invoice have many payment.
for calculating payment I have used a logic hook in payment module.
now I want invoice_id in payment module to retrive data.
for that I use
$invoice = new invoi_invoice();
$invi = $invoice->get_linked_beans('invoi_invoice_t_hotel_payment_1','invoi_invoice');
var_dump($invi);
it return
array(0){
}
and also I used
$invoice = new invoi_invoice();
$id=$invoice->retrieve($bean->invoi_invoice_t_hotel_payment_1invoi_invoice_ida);
but this also does not give me id of invoice.
i have read lots of blog and tutorial all are grabing parent record same like me.
but I don1t get id till now.
any help please..
I got the solution
for simply getting the parent id use
var_dump($_REQUEST);
then you got parent id like this:-
$parent_id=$_REQUEST["return_id"];
I working on e-commerce website using Satchmo. However, there are few customization required for my store.
While ordering a product I should be able to specify a delivery date (shipping date).
There can be only 20 (max_num_delievries) deliveries possible per day for a product. If number of deliveries for a particular date for a particular product exceeds 'max_num_delievries', user should not be able to select that date while ordering the product.
Can someone please help in this and guide me how to achieve this using Satchmo?
Thanks in advance..
I would try something like this:
1) create a local app (eg. delivery_date) with a model like "DeliveryDate" or so. For example localsite/delivery_date/models.py:
class DeliveryDate(models.Model):
product = models.ForeignKey(Product)
date = models.DateField()
order = models.ManyToManyField(Order)
class Meta:
unique_together = ("product", "date")
2) the validation of the max 20 existing orders... mhh, good question, maybe the best would be, to do it on the form? Override the clean method and check if this delivery date is associated with 20 orders already... maybe something like localsite/delivery_date/forms.py
class DeliveryDateForm(forms.ModelForm):
class Meta:
model = DeliveryDate
def clean(self):
super(DeliveryDateForm, self).clean()
... check here the order_set count
... but maybe the form isn't the best place to do this.
You also probably want to hide and auto-set the initial values for product and order yourself, and the user only being supposed to select a date.
3) Regarding satchmo... I would use signals to react after a product has been added to the cart (there is a signal just for this case), and add a listener which redirects the user to a view where he can select the date for this product. Look at the example here with the signal "cart_add_view": http://www.facebook.com/note.php?note_id=101466134049
Maybe ajax would be a good option here. With a hidden container in your page... which shows up after adding a product to the cart (only if the product hasn't already a DeliveryDate associated to this order/product), and asking the user to select a date.
This whole stuff would be on the listener: check if the product needs a delivery date, and if yes, send an ajax response to pop-up the window, and put in the repsonse-context the form, with the initial product and order hidden fields.
And to save the delivery-date you will need another ajax-view.
Well it's merely an idea how I would try to do it ;-) It will probably need adjustments here and there, of course. But hopefully it helps you further.
Regards,
Andrea