get post values through steps in checkout file cs-cart - cs-cart

I am in the checkout page on cs-cart (version 4.1.2) I have opened the firebug to see what variables are sending through pages 3 to 4.
In the post tab, I saw this variable: shipping_ids[0] = 3
How can I take this variable in the step 4, which it is the payment methods?
I tried lots of things, but still no luck!
{$smarty.post.shipping_ids} or ..get..
*In the 3 step, I have 5 options, so client could choose one of them. So I have also tried to get the value through javascript... still nothing... maybe I forget something or did something wrong..
Could anyone guide me or share any suggestions?

Try this:
{foreach from=$cart.shipping key="id" item="shipping"}
{$id} {*shipping id*}
{$shipping.shipping} {*shipping name*}
{/foreach}
You should probably debug the controller instead, as this is where all the variables come from. Take a look at checkout.php controller. Look for $view->assign calls.
Update:
I have updated the code above. Notice that the key of the $cart.shipping array is actually the id of the shipping.

Related

SCA SuiteScript query item to code

I need to add an non-inventory item by internal id to the cart in SCA, how would I go about pulling that item and then adding it? The code samples I find are for pulling data always refer to views, I am thinking I need to pull it as an item, as I need to add it as an item using methods in LiveOrder.Model
thanks for anyhelp you may give
Really depends on which version of SCA you are using.
The quick answer is to look in the ItemDetails.View.js file in the Modules directory and find the code for the addToCart method.
The longer answer is that SCA's architecture and performance leave much to be desired. If you have things like multiple add to or update cart I found that it was easier to write my own cart.ss service and then just forward to the cart or refresh the page on completion.
So I found out that the easiest way to do this is like this, the items are returns in a object array, so thanks for your help
$.get('/api/items?id=10779&fieldset=details', function(obj) {
}).done(function(obj) {
});

How do I get Magento to always give the /catalog/product/view/id/ style url for products?

I want Magento to always generate product urls in the format:
www.example.com/catalog/product/view/id/123/s/product-name.html
instead of the rewritten
www.example.com/product-name.html
The reason for this is mainly so that I don't have to worry if something happens to all my rewrites, or so I can feel free to truncate and rebuild core_url_rewrite if something goes wrong and it gets too big.
I don't want to stop using rewritten urls entirely. I like them for categories. I have fewer categories, and I very rarely change the names. I hate feeling like I can't change the name of a product because it will make the core_url_rewrite table grow and mess up any backlinks I've generated if I lose my rewrites. Also, I still want my current urls to work for as long as possible along with the /product/view/id urls.
Is there an easy way to do this without rewriting methods that I'm missing?
Or do I have to override some getProductUrl method? It looks like the answer lies in the getProductUrl() method in Mage_Catalog_Model_Product? That class seems to use the getProductUrl() method in Mage_Catalog_Model_Product_Url.
But again, if there's some simple configuration setting that would do the trick, I'd rather do that.
Magento handled it by own. Please follow the below steps.
1.Login to the admin panel
2. Then System >> Configuration >> Catalog >> Catalog >> Search Engine Optimization
3. Then Change the settings as per your requirement
4. As per your current requirement "Use Categories Path for Product URLs" will be YES
5. Then try to reindex full Via SSH.
Hope it will works.
Thanks

How to make wp plugin auto-refreshing on the public side of view (auto load page)

First have to say that almost every time when searching on technical solutions.. search engine will direct me to this site here. I admit that i have learned such A LOT here just by searching through for answers..
but also have to say that not being a coder.. so don't understand much here at all ;)
Ok, the Problem:
Want to update wordpress tables or calendar within wp admin. These changes should become updated on the public side automatically and more or less instantly (~ few seconds is perfectly fine).
I found solutions about manipulating header.php, i found some ajax plugins I found -too much to count- info on how to implement ajax into wp
Sadly.. none of these could help me through as the plugins mostly either not work, are outdated or require countless file edits. Manipulating header.php seems odd.. as i don't want to loop-refresh the whole page, post etc.. but only get e.g. table or calendar data updated.
So maybe any of you coders know of something to e.g. get the plugin "All-in-One Event Calendar by Timely" to update the public visible part of the calendar once data edited in wp admin?
Greatly appreciate pointers in any direction to solve this.
P.S.: What would you think of plugins like "ajaxify everything" ? don't know if this really the way to go..
Again, thanks for your help, time and contribution!!
update
additional question:
I now found such plugin to let me chose which parts i want to "ajaxify".
Such plugin would ask me for a specific function name.
Now, where do i start to gather this information?
Below is the instruction from the plugin context inside wordpress admin
Generate Ajaxized DIV for your function
Ajaxize will allow you to ajaxize almost any php function on your
site.
It can be a plugin, a function you wrote, or even a core wordpress
function.
There are some (obvious or less obvious) limitations currently:
Functions must return valid HTML - this will be called in php and returned via the
Ajax call
Functions cannot accept any parameters (at least at the moment)
Enter a function name below.
Function Name: xxx input field xxx what put in here? xxx
The generated div can be inserted to any page/post on the site and
will ajaxize the call to the function automatically.
Please make sure you enter a valid function name, that the function
does not require any parameters, and that it returns valid HTML.
In your context you want to refresh the calendar automaticaly when there is a change in the WP_Admin;
but you can't exactly do this.
You can write a Js method which will check the time of lastest modification of the calendar at the load of the page, stock it in Var.
After you'll have a constant (each 10seconds) Js "daemon" which will get the time of lastest modification of the calendar and compare it to the stocked Var; If change you reload the calendar.
PS: Ajaxify everything is not really a solution due of the developpement you need To Ajaxify and to code for people who has disabled Javascript.
Hope it helps

Google Analytics not tracking conversions in Magento 1.7

I'm using Magento's built in Googleanalytics module which is working fine for page views, but not for conversions. The account is set up fine on Google, but it's not adding the addTrans part in the checkout/onepage/success page.
I've done a lot of digging this morning, and found that the observer does observe the "checkout_onepage_controller_success_action" correctly, and does indeed run. It does the following:
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('google_analytics');
if ($block) {
$block->setOrderIds($orderIds);
}
I've done some echoing, and it does retrieve the block, and it also sets the order ids correctly. However, in the block itself, if I echo out $this->getOrderIds(); its empty.
My next thought was that perhaps it could be using two GA blocks on the page, and maybe its passing the data to the first one but echoing the HTML of the 2nd one, but I've no clue how to start checking that! The Googleanalytics.xml file only has one block it in, and I don't use that block name anywhere else!
Anyone experienced similar? Or have any idea where I can go from here?
EDIT:
The Ga.php block includes the transaction code if $this->getOrderIds() returns an array, which it is not doing. However, the observer is doing $block->setOrderIds($order_ids); which is passing through an array containing an order id. So the observer is passing the ids to the block, and the block is receiving them (setting up a method of setBlockIds and echoing out the argument, does show the array), but when the block tries to access its own data, it's suddenly not there ($block->getData() returns an array of properties but there is no order_ids property).
I also figured maybe it could be that its echoing the blocks HTML before setting the order id, so I added some variables in to check that and it's not that - its definitely setting the order_ids before trying to get them again, but its still not working!
I'm completely stumped! My only idea now is to modify the Ga.php block to use Magento's registry instead of it's own _data property, which is really not a nice way of doing it!
I think i've been an utter tool. Magento wasn't tracking conversions on the live site because I hadn't put the account code in the configuration part, but I had on my test site.
I had previously put my own analytics code in the template, so I had tracked page views.
When I saw no conversions (despite putting the account code in my test site), I started making orders on the test site and then viewing the source of the order success page. Firefox loads its source as a new request...which automatically goes to the empty basket page. So obviously, it wasn't showing the addTrans or anything, because it had already done that.
A quick check in firebug revealled it was working as it should.
So in the end, after a day of searching, I had to change "No" to "Yes" in the admin, and type in the account code. Great.

Wordpress: How do I convert a generated URL (permalink) to a pretty URL?

In a plugin, I am generating a paginated link to a category,
i.e. http://localhost/?cat=17&paged=5. The category is known by slug and id.
Is there a way to have this URL converted to the user defined "nice permalink" format,
i.e. http://localhost/category/foo/page/5?
(Assuming we're running Wordpress 2.8/2.9+)
Edit: Since there are some misunderstandings about what I'm trying to achieve, here's what I have:
The category ID
The page number (i.e. the fifth page of that category's archive)
With these data I can create the URL to that page, which would be, for example, http://localhost/?cat=17&paged=5, and that works well. The problem is of a visual nature: If the user has pretty permalinks enabled, then this won't fit in very well.
Question is: How do I get the correct, pretty permalink (i.e. http://localhost/category/foo/page/5) from (or for) the information I have?
Edit 2: Obviously if a user has pretty permalinks disabled, then there are no pretty permalinks. I know that, and that is really not subject of the question ... For the moment, let's just assume the user has an arbitrary permalink setting. I generate a link, and it should look like the user wants it to.
Have you looked at the WP_Rewrite?
Does All In One SEO meet your requirements? I actually bought the "pro" version for like $30 USD and it was well worth it.
My Wordpress installation (2.9.2) does this automatically - canonical URLs have been built into Wordpress for some time. Maybe your plugin is disabling this feature?
I'm guessing you already figured it out but I just wanted to put this out for others. I think I understand your situation. If I've read your question correctly, changing admin permalink settings does not apply.
You can get the category ID then use get_category_link() function to get the 'pretty' permalink. Then append the pagination to the end.
You could explode the permalink to get the category ID and pagination number, then use the step above to put it together.
Is this what you were looking for?
The correct way to generate the link would be to use get_category_link and add_query_arg
In your example, the following would work:
$category_link = add_query_arg( array('paged' => 5), get_category_link($category->term_id));
This will generate the URL and Wordpress will redirect to the correct page.
check this page out, it explains pretty permalinks pretty good.
http://codex.wordpress.org/Using_Permalinks
You should find these settings in
Wordpress->Settings->Permalinks
I think
/%category%/%postname%
in the direction what you want
You can also try to redirect your url using htaccess, here are some examples:
[http://]perishablepress.com/press/2008/02/06/permalink-evolution-customize-and-optimize-your-dated-wordpress-permalinks/
Sorry darf bis jetzt nur ein link posten pfft... :-(
kind regards,
Mahatmanich

Resources