Added product not showing in magento shopping cart - magento-1.4

I made a custom module that sell used product along with original product and in that i added an "Add to Cart" Button like this,
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getUrl('checkout/cart/add',array('product'=>$_marketplace["entity_id"],'qty'=>1)) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php echo $this->getChildHtml('', true, true) ?>
So when I add the product to shopping cart, it is showing "product was added to your shopping cart." along with "You have no items in your shopping cart." ie, product added is not getting reflected in cart. But if i navigate to checkout and come back or if I add another original product, the used product and original product is getting reflected.
This happens only when we checkout the used product 1st time to the empty cart. If cart have any other product we can checkout the used product without a problem.
Do anyone have any idea?
Note: I added some custom attribute to products such as is_used, p_id ( formerly it was parent_product_id, which was causing problem.) etc

After a few days of debugging, I solved it by just changing the custom attribute field name from parent_product_id to p_id.

Related

TFS Work Item AssignedTo dropdown missing items

I added a TFS group [Projects]\Business Analysts. Some of the people assigned to this group do not show up in the dropdown. Anyone know why this would happen?
Additionally, when I access the AssignedTo field from the context menu on the backlog page the names are completely different than those on the Product Backlog AssignedTo List.
Here is work item definition for the group:
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<ALLOWEXISTINGVALUE />
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[Project]\Business Analysts" />
</ALLOWEDVALUES>
<HELPTEXT>Organizer of product feature</HELPTEXT>
</FIELD>
Are the people that are not showing up part of the project in any way? Did you put the full group inside one of the OOB groups (contributors, Admins, etc.) or in a team in this project. If the missing individual don't have access to the project they won't show up in the dropdowns this rule doesn't add them to the project just filter user in that group in the assigned to field.
Some of the people assigned to this group do not show up in the
dropdown.
The drop down is actually a cached list of users you have assigned tasks to in the past.
So, you just need enter their first name or email address to search him and assign to him. Next time, you will see him in the drop down list.
Details steps:
When assigning a user to a task, enter their first name and click the search button. The user should be brought back by the search. Assign the user to the task.
Next time you go to assign a user to a task, if you click on the drop down list should now display the user as it is now cached.
For details please take a look at Ewald Hofman's response in this question: TFS-2015 limiting user list
If you still not able to see those users after manually search their name/e-mail, then you may have to check the corresponding permission. Make sure all of them have sufficient permissions.
Hope this helps.

What to add in my controller in Grails?

I'm doing an application where after log in, User gets some settings (in check-boxes) which are Boolean in my database.
I'm trying to make that every User have his own settings checked, apropose when User logs checked are those fields where the value in the database is 1. My check-box is:
<g:checkBox name="task" value="${setting?.message}" />
<label class="text2" for="calendar">Things to done</label>
What I have to write in my controller?
in your scenario i understand there exist a one to many relationship between user and setting, as you explain after user successfully login user is take it to a view where are listed all possible setting.
you can do this in the view
<g:each in="${settings}" var="setting">
<label class="checkbox">
<g:checkBox name="settings" value="${setting}" checked="${user?.settings?.contains(setting)}"/> ${setting}
</label>
</g:each>
i took this code from a similar scenario i solve someday ago you can see it here in this github repo
after sending the form in the controller you can handle in this way
def settings = params.list("settings")
you can see the full action controler example here
You could now apply some user.addToSettings or user.removeFromSetting in order to save selected settings
i hope it help you

Rails Shopping Cart Maximum amount

I am working on a rails 3 app and have a shopping cart functionality. On the products page I have Items listed and "Add to Cart". the cart is also rendered on same page as a partial. Now I need functionality to put in a maximum amount allowed in a cart. I have a input box on that page for this. When I click checkout I need to compare the the total cart price against the maximum amount and display appropriate message. Where do (which controller action) I capture form value for the maximum amount?
It would be nice if you add some code. No one is gonna tell you that at least that you said what controllers uses for your shopping cart. Maybe you should add a action in your "shop" controller, and add your restful route in your routes file.

How to redirect user back to list item form when list item is edited in SharePoint 2007?

Out of the box, I've noticed the following user experience in SharePoint 2007:
User navigates to a list.
User opens list item for display.
User selects "Edit Item" link.
User changes the list item, presses Submit.
User is redirected back to list.
Is it possible to change the last step so the user is redirected back to the list item display form? If so, how is it done?
You can create a custom form by with SharePoint Designer then customize the OK Button to save and redirect to the display view.
To create custom edit form using SharePoint Designer here is a full instructions on how to do thi http://office.microsoft.com/en-ca/sharepoint-designer-help/create-a-custom-list-form-HA010119111.aspx
Once you done this then find this line on the source code of you new page
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
and append this line below
<xsl:param name="ListItemId">0</xsl:param>
"this will make the id of the current item accessible by the button"
replace both of your OK buttons
<SharePoint:SaveButton runat="server" ControlMode="Edit" id="savebutton1"/>
whit this one
<input type="button" value="OK" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={dispform.aspx?id=',$ListItemId,'}'))}" />
Save and test :).
You don't necessarily have to replace your OK buttons for this one you can also add this extra button and instead of calling it OK call it something like Save and display and let the user decide what to do (just and idea)
Hope this helps!

Tricky ruby on rails problem. Does an easy solution exist?

I hope my question is understandable, else I'm glad to clarify.
We have this sport event coming up, and I have the pleasure to register the people. :)
Facts:
one can have a team of 5-10 persons.
Need to know the order in which the people start.
Need to know who the team leader is.
I did a form in the following style:
o [____Write first name here___] <--- this is a textfield
o [____Write second name here__]
o [___________ ... ____________]
...
the "o" is a radio-button, used to pick the team leader.
I have a model Person and a model Team. Every team has a leader_id (which is one of the Person IDs). Furthermore every team :has_many persons.
In the controller I have
def create
#team = Team.new(params[:team])
#team.save #just assume there are no errors
end
In the view I have (for the radio-buttons):
<input id="team_leader_id_**????**"
name="team[leader_id]"
type="radio"
value="**????**"
/>
<input id="team_leader_id_**????**"
name="team[leader_id]"
type="radio"
value="**????**"
/>
# etc.
My question: What should I put at **????** ?
I don't know the IDs of the persons yet, as they haven't been created. I have to put some meta-ID there, which ruby on rails recognizes and links everything correctly?
You don't have to read the rest (it describes the hack I'm using)
As said, at the moment I'm doing an ugly hack: first save the Team (without generating a leader), then fetch the same team from the db, get its people, and find the first person matching the value of
params[:team][:leader_id].
Finally saving this person's ID in the field of leader_id of the team.
But this code is inefficient, huge and buggy, that I suspect there is an easier way.
The radios should have the same name i.e.
<input id="team_persons_attributes_0_leader_id"
name="team[persons_attributes][leader_id]"
type="radio"
value="0"
/>
<input id="team_persons_attributes_1_leader_id"
name="team[persons_attributes][leader_id]"
type="radio"
value="1"
/>
<input id="team_persons_attributes_2_leader_id"
name="team[persons_attributes][leader_id]"
type="radio"
value="2"
/>
This way there can only be one selected (via the browsers internal radio button mechanism) and params[:team][:persons_attributes][:leader_id] will contain an index to params[:team][:persons] which will be the leader's name.
to obtain the id
team = Team.create(params[:team])
params[:team][:persons].each_with_index{|name, idx|
person = Persons.create(:name => name)
#assuming no errors
team.leader_id = person.id if params[:team][:persons_attributes][:leader_id] == idx
}
It seems as though you are submitting a number of users in one go with one of them flagged as the team leader. In this case you could construct something like:
<%= radio_button_tag "[team][leader]","[1]" %>
<%= radio_button_tag "[team][leader]","[2]" %>>
Then in the controller create the people (using nested attributes?), then simply look up the ID of the one flagged as the leader for the team record.

Resources