Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to Get all website id ? 
 
tulipe
Jr. Member
 
Total Posts:  7
Joined:  2013-03-07
 

Hi,

i use the module Auguria Sponsorship(it’s free), but the coupon auto-generated can’t be use in my two store website.

I want select both website in the Shopping Cart Price Rules when the coupon is auto-created.

in the file PointController.php i have this code to be changed :

$websiteId $customer->getWebsiteId();       <= line 242 to change
                $data 
= array
                (
                        
"name" => $name,
                        
"description" => $description,
                        
"from_date" => $date,
                        
"coupon_code" => $couponCode,
                        
"coupon_type" => 2,
                        
"uses_per_coupon" => 1,
                        
//"uses_per_customer" => 1,
                        
"customer_group_ids" => Array(=> $customerGroupId),//get customer group
                        
"is_active" => 1,
                        
"conditions_serialized" => 'a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
                        
"actions_serialized" => 'a:6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}',
                        
"stop_rules_processing" => 0,
                        
"is_advanced" => 1,
                        
"sort_order" => 0,
                        
"simple_action" => "cart_fixed",
                        
"discount_amount" => $discountAmount,
                        
"discount_qty" => 1.0000,
                        
"discount_step" => 0,
                        
"simple_free_shipping" => 0,
                        
"times_used" => 0,
                        
"is_rss" => 1,
                        
"website_ids" => Array(=> $websiteId);   <= line 266 to change
                
);

When i changed the line 242 and 266 that select my second web site :

$websiteId $customer->getWebsiteId();  
and 
"website_ids" => Array(=> $websiteId)//get website id

to

$websiteId 2
 
and 
"website_ids" => Array(=> $websiteId)//get website id

i tried this but didn’t work :(

$websiteId =1
and
"website_ids" => Array(1,=> $websiteId)

What is the code to select all website ID please?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

$withDefault false;//change to true if you want default website also selected
$websiteIds array_key(Mage::app()->getWebsites($withDefault));
 
Magento Community Magento Community
Magento Community
Magento Community
 
tulipe
Jr. Member
 
Total Posts:  7
Joined:  2013-03-07
 

Hi,

thx for the reply Ryan Sun _Kuafu but it didn’t work.

Finally i found how to change :

line 266

"website_ids" => Mage::getModel('core/store')->getCollection()->getAllIds()//get website id

Hope that help other people.

 
Magento Community Magento Community
Magento Community
Magento Community
 
psd2magento
Jr. Member
 
Total Posts:  13
Joined:  2013-04-05
Ahmedabad, India
 

Hi Tulipe,

Your code will give us store ids not website ids.

We can get all website ids using below code.
Mage::getModel(’core/website’)->getCollection()->getAllIds();”

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top